MCPcopy
hub / github.com/connectrpc/connect-go / TestGRPCPercentEncoding

Function TestGRPCPercentEncoding

protocol_grpc_test.go:163–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

161}
162
163func TestGRPCPercentEncoding(t *testing.T) {
164 t.Parallel()
165 roundtrip := func(input string) {
166 assert.True(t, utf8.ValidString(input), assert.Sprintf("input invalid UTF-8"))
167 encoded := grpcPercentEncode(input)
168 t.Logf("%q encoded as %q", input, encoded)
169 decoded, err := grpcPercentDecode(encoded)
170 assert.Nil(t, err)
171 assert.Equal(t, decoded, input)
172 }
173
174 roundtrip("foo")
175 roundtrip("foo bar")
176 roundtrip(`foo%bar`)
177 roundtrip("fiancée")
178}
179
180func TestGRPCWebTrailerMarshalling(t *testing.T) {
181 t.Parallel()

Callers

nothing calls this directly

Calls 6

TrueFunction · 0.92
SprintfFunction · 0.92
NilFunction · 0.92
EqualFunction · 0.92
grpcPercentEncodeFunction · 0.85
grpcPercentDecodeFunction · 0.85

Tested by

no test coverage detected