diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2020-05-20 22:56:01 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2020-05-20 22:56:01 -0400 |
| commit | aa527c49e11a5c158cf87df9969b882395a735e7 (patch) | |
| tree | 41d040e7ef706b1160bcf6297e0f69b9b3078d2c /data/datasource_http_test.go | |
| parent | 7597dd94a53f834e67c35df51dccf90fe56b7f82 (diff) | |
Refactoring: deduplicating identical URL-parsing functions
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'data/datasource_http_test.go')
| -rw-r--r-- | data/datasource_http_test.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/data/datasource_http_test.go b/data/datasource_http_test.go index f35733db..7f8515cc 100644 --- a/data/datasource_http_test.go +++ b/data/datasource_http_test.go @@ -118,50 +118,6 @@ func TestHTTPFileWithHeaders(t *testing.T) { assert.Equal(t, must(marshalObj(expected, json.Marshal)), must(marshalObj(actual, json.Marshal))) } -func TestParseHeaderArgs(t *testing.T) { - args := []string{ - "foo=Accept: application/json", - "bar=Authorization: Bearer supersecret", - } - expected := map[string]http.Header{ - "foo": { - "Accept": {jsonMimetype}, - }, - "bar": { - "Authorization": {"Bearer supersecret"}, - }, - } - parsed, err := parseHeaderArgs(args) - assert.NoError(t, err) - assert.Equal(t, expected, parsed) - - _, err = parseHeaderArgs([]string{"foo"}) - assert.Error(t, err) - - _, err = parseHeaderArgs([]string{"foo=bar"}) - assert.Error(t, err) - - args = []string{ - "foo=Accept: application/json", - "foo=Foo: bar", - "foo=foo: baz", - "foo=fOO: qux", - "bar=Authorization: Bearer supersecret", - } - expected = map[string]http.Header{ - "foo": { - "Accept": {jsonMimetype}, - "Foo": {"bar", "baz", "qux"}, - }, - "bar": { - "Authorization": {"Bearer supersecret"}, - }, - } - parsed, err = parseHeaderArgs(args) - assert.NoError(t, err) - assert.Equal(t, expected, parsed) -} - func TestBuildURL(t *testing.T) { expected := "https://example.com/index.html" base := mustParseURL(expected) |
