diff options
Diffstat (limited to 'data/datasource_http.go')
| -rw-r--r-- | data/datasource_http.go | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/data/datasource_http.go b/data/datasource_http.go index 5424fbd0..e809768e 100644 --- a/data/datasource_http.go +++ b/data/datasource_http.go @@ -5,7 +5,6 @@ import ( "mime" "net/http" "net/url" - "strings" "time" "github.com/pkg/errors" @@ -61,40 +60,3 @@ func readHTTP(source *Source, args ...string) ([]byte, error) { } return body, nil } - -func parseHeaderArgs(headerArgs []string) (map[string]http.Header, error) { - headers := make(map[string]http.Header) - for _, v := range headerArgs { - ds, name, value, err := splitHeaderArg(v) - if err != nil { - return nil, err - } - if _, ok := headers[ds]; !ok { - headers[ds] = make(http.Header) - } - headers[ds][name] = append(headers[ds][name], strings.TrimSpace(value)) - } - return headers, nil -} - -func splitHeaderArg(arg string) (datasourceAlias, name, value string, err error) { - parts := strings.SplitN(arg, "=", 2) - if len(parts) != 2 { - err = errors.Errorf("Invalid datasource-header option '%s'", arg) - return "", "", "", err - } - datasourceAlias = parts[0] - name, value, err = splitHeader(parts[1]) - return datasourceAlias, name, value, err -} - -func splitHeader(header string) (name, value string, err error) { - parts := strings.SplitN(header, ":", 2) - if len(parts) != 2 { - err = errors.Errorf("Invalid HTTP Header format '%s'", header) - return "", "", err - } - name = http.CanonicalHeaderKey(parts[0]) - value = parts[1] - return name, value, nil -} |
