diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/rs/cors/utils.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/rs/cors/utils.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/rs/cors/utils.go b/Godeps/_workspace/src/github.com/rs/cors/utils.go new file mode 100644 index 000000000..429ab1114 --- /dev/null +++ b/Godeps/_workspace/src/github.com/rs/cors/utils.go @@ -0,0 +1,27 @@ +package cors + +import ( + "net/http" + "strings" +) + +type converter func(string) string + +// convert converts a list of string using the passed converter function +func convert(s []string, c converter) []string { + out := []string{} + for _, i := range s { + out = append(out, c(i)) + } + return out +} + +func parseHeaderList(headerList string) (headers []string) { + for _, header := range strings.Split(headerList, ",") { + header = http.CanonicalHeaderKey(strings.TrimSpace(header)) + if header != "" { + headers = append(headers, header) + } + } + return headers +} |