MCPcopy Create free account
hub / github.com/aws/smithy-go / TestHeaderValue

Function TestHeaderValue

encoding/httpbinding/header_test.go:11–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestHeaderValue(t *testing.T) {
12 const keyName = "test-key"
13 const expectedKeyName = "test-key"
14
15 cases := map[string]struct {
16 header http.Header
17 args []interface{}
18 append bool
19 expected http.Header
20 }{
21 "set blob": {
22 header: http.Header{expectedKeyName: []string{"foobar"}},
23 args: []interface{}{[]byte("baz")},
24 expected: map[string][]string{
25 expectedKeyName: {"YmF6"},
26 },
27 },
28 "set boolean": {
29 header: http.Header{expectedKeyName: []string{"foobar"}},
30 args: []interface{}{true},
31 expected: map[string][]string{
32 expectedKeyName: {"true"},
33 },
34 },
35 "set string": {
36 header: http.Header{expectedKeyName: []string{"foobar"}},
37 args: []interface{}{"string value"},
38 expected: map[string][]string{
39 expectedKeyName: {"string value"},
40 },
41 },
42 "set byte": {
43 header: http.Header{expectedKeyName: []string{"127"}},
44 args: []interface{}{int8(127)},
45 expected: map[string][]string{
46 expectedKeyName: {"127"},
47 },
48 },
49 "set short": {
50 header: http.Header{expectedKeyName: []string{"foobar"}},
51 args: []interface{}{int16(32767)},
52 expected: map[string][]string{
53 expectedKeyName: {"32767"},
54 },
55 },
56 "set integer": {
57 header: http.Header{expectedKeyName: []string{"foobar"}},
58 args: []interface{}{int32(2147483647)},
59 expected: map[string][]string{
60 expectedKeyName: {"2147483647"},
61 },
62 },
63 "set long": {
64 header: http.Header{expectedKeyName: []string{"foobar"}},
65 args: []interface{}{int64(9223372036854775807)},
66 expected: map[string][]string{
67 expectedKeyName: {"9223372036854775807"},
68 },

Callers

nothing calls this directly

Calls 3

newHeaderValueFunction · 0.85
setHeaderFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected