MCPcopy Create free account
hub / github.com/hashicorp/vault / TestRequestSetJSONBody

Function TestRequestSetJSONBody

api/request_test.go:11–23  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestRequestSetJSONBody(t *testing.T) {
12 var r Request
13 raw := map[string]interface{}{"foo": "bar"}
14 if err := r.SetJSONBody(raw); err != nil {
15 t.Fatalf("err: %s", err)
16 }
17
18 expected := `{"foo":"bar"}`
19 actual := strings.TrimSpace(string(r.BodyBytes))
20 if actual != expected {
21 t.Fatalf("bad: %s", actual)
22 }
23}
24
25func TestRequestResetJSONBody(t *testing.T) {
26 var r Request

Callers

nothing calls this directly

Calls 2

SetJSONBodyMethod · 0.95
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…