diff --git a/aws/protocol/rest/encode_test.go b/aws/protocol/rest/encode_test.go index 625d7962fba..63c69fc780c 100644 --- a/aws/protocol/rest/encode_test.go +++ b/aws/protocol/rest/encode_test.go @@ -21,8 +21,8 @@ func TestEncoder(t *testing.T) { expected := http.Request{ Header: map[string][]string{ "custom-user-header": {"someValue"}, - "x-amzn-header-foo": {"someValue"}, - "x-amzn-meta-foo": {"someValue"}, + "X-Amzn-Header-Foo": {"someValue"}, + "X-Amzn-Meta-Foo": {"someValue"}, }, URL: &url.URL{ Path: "/some/someValue/path", diff --git a/aws/protocol/rest/header.go b/aws/protocol/rest/header.go index 94917e969c0..ebf934b3dce 100644 --- a/aws/protocol/rest/header.go +++ b/aws/protocol/rest/header.go @@ -43,17 +43,11 @@ func newHeaderValue(header http.Header, key string, append bool) HeaderValue { } func (h HeaderValue) modifyHeader(value string) { - lk := strings.ToLower(h.key) - - val := h.header[lk] - if h.append { - val = append(val, value) + h.header.Add(h.key, value) } else { - val = append(val[:0], value) + h.header.Set(h.key, value) } - - h.header[lk] = val } // String encodes the value v as the header string value diff --git a/aws/protocol/rest/header_test.go b/aws/protocol/rest/header_test.go index db847eb2a99..f5ee99f8150 100644 --- a/aws/protocol/rest/header_test.go +++ b/aws/protocol/rest/header_test.go @@ -13,7 +13,7 @@ import ( func TestHeaderValue(t *testing.T) { const keyName = "test-key" - const expectedKeyName = keyName + const expectedKeyName = "Test-Key" cases := map[string]struct { header http.Header @@ -142,20 +142,20 @@ func TestHeaders(t *testing.T) { }{ "set": { headers: http.Header{ - "x-amzn-meta-foo": {"bazValue"}, + "X-Amzn-Meta-Foo": {"bazValue"}, }, values: map[string]string{ "foo": "fooValue", " bar ": "barValue", }, expected: http.Header{ - "x-amzn-meta-foo": {"fooValue"}, - "x-amzn-meta-bar": {"barValue"}, + "X-Amzn-Meta-Foo": {"fooValue"}, + "X-Amzn-Meta-Bar": {"barValue"}, }, }, "add": { headers: http.Header{ - "x-amzn-meta-foo": {"bazValue"}, + "X-Amzn-Meta-Foo": {"bazValue"}, }, values: map[string]string{ "foo": "fooValue", @@ -163,8 +163,8 @@ func TestHeaders(t *testing.T) { }, append: true, expected: http.Header{ - "x-amzn-meta-foo": {"bazValue", "fooValue"}, - "x-amzn-meta-bar": {"barValue"}, + "X-Amzn-Meta-Foo": {"bazValue", "fooValue"}, + "X-Amzn-Meta-Bar": {"barValue"}, }, }, }