MCPcopy Create free account
hub / github.com/chainreactors/spray / TestBuild_FuzzInBody

Function TestBuild_FuzzInBody

core/ihttp/request_fuzz_test.go:64–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestBuild_FuzzInBody(t *testing.T) {
65 rc := &RequestConfig{
66 Method: "POST",
67 Headers: make(http.Header),
68 Body: []byte(`{"user": "{{FUZZ}}"}`),
69 }
70 req, err := rc.Build(context.Background(), STANDARD, "http://example.com", "/login", "", "admin")
71 if err != nil {
72 t.Fatal(err)
73 }
74 buf := make([]byte, 1024)
75 n, _ := req.StandardRequest.Body.Read(buf)
76 body := string(buf[:n])
77 expected := `{"user": "admin"}`
78 if body != expected {
79 t.Errorf("Body = %q, want %q", body, expected)
80 }
81}
82
83func TestBuild_FuzzInQuery(t *testing.T) {
84 rc := &RequestConfig{

Callers

nothing calls this directly

Calls 1

BuildMethod · 0.95

Tested by

no test coverage detected