MCPcopy
hub / github.com/grpc/grpc-go / TestDecodeMetadataHeader

Method TestDecodeMetadataHeader

internal/transport/http_util_test.go:200–220  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func (s) TestDecodeMetadataHeader(t *testing.T) {
201 for _, test := range []struct {
202 // input
203 kin string
204 vin string
205 // output
206 vout string
207 err error
208 }{
209 {"a", "abc", "abc", nil},
210 {"key-bin", "Zm9vAGJhcg==", "foo\x00bar", nil},
211 {"key-bin", "Zm9vAGJhcg", "foo\x00bar", nil},
212 {"key-bin", "woA=", binaryValue, nil},
213 {"a", "abc,efg", "abc,efg", nil},
214 } {
215 v, err := decodeMetadataHeader(test.kin, test.vin)
216 if !reflect.DeepEqual(v, test.vout) || !reflect.DeepEqual(err, test.err) {
217 t.Fatalf("decodeMetadataHeader(%q, %q) = %q, %v, want %q, %v", test.kin, test.vin, v, err, test.vout, test.err)
218 }
219 }
220}
221
222func (s) TestParseDialTarget(t *testing.T) {
223 for _, test := range []struct {

Callers

nothing calls this directly

Calls 2

decodeMetadataHeaderFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected