MCPcopy Create free account
hub / github.com/apache/pulsar-client-go / TestEncodeJSONBody

Function TestEncodeJSONBody

pulsaradmin/pkg/rest/client_test.go:27–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestEncodeJSONBody(t *testing.T) {
28 testcases := []struct {
29 obj interface{}
30 expected int
31 }{
32 {obj: "1", expected: 3},
33 {obj: "12", expected: 4},
34 {obj: 1, expected: 1},
35 {obj: 12, expected: 2},
36 }
37
38 for _, testcase := range testcases {
39 r, err := encodeJSONBody(testcase.obj)
40 require.NoError(t, err)
41
42 b, err := io.ReadAll(r)
43 require.NoError(t, err)
44
45 require.Equal(t, testcase.expected, len(b))
46 }
47}

Callers

nothing calls this directly

Calls 1

encodeJSONBodyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…