MCPcopy Index your code
hub / github.com/kataras/iris / readJSON

Function readJSON

x/client/client_test.go:53–63  ·  view source on GitHub ↗
(t *testing.T, ptr interface{}, expected interface{})

Source from the content-addressed store, hash-verified

51}
52
53func readJSON(t *testing.T, ptr interface{}, expected interface{}) http.HandlerFunc {
54 return func(w http.ResponseWriter, r *http.Request) {
55 if err := json.NewDecoder(r.Body).Decode(ptr); err != nil {
56 t.Fatal(err)
57 }
58
59 if !reflect.DeepEqual(ptr, expected) {
60 t.Fatalf("expected to read json: %#+v but got: %#+v", ptr, expected)
61 }
62 }
63}

Callers 1

TestClientJSONFunction · 0.85

Calls 4

FatalMethod · 0.80
DeepEqualMethod · 0.80
FatalfMethod · 0.80
DecodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…