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

Function TestBuild_FuzzInHeader

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

Source from the content-addressed store, hash-verified

39}
40
41func TestBuild_FuzzInHeader(t *testing.T) {
42 headers := make(http.Header)
43 headers.Set("Authorization", "Bearer {{FUZZ}}")
44 headers.Set("X-Normal", "static-value")
45
46 rc := &RequestConfig{
47 Method: "GET",
48 Headers: headers,
49 }
50 req, err := rc.Build(context.Background(), STANDARD, "http://example.com", "/test", "", "token123")
51 if err != nil {
52 t.Fatal(err)
53 }
54 authVal := req.StandardRequest.Header.Get("Authorization")
55 if authVal != "Bearer token123" {
56 t.Errorf("Authorization = %q, want 'Bearer token123'", authVal)
57 }
58 normalVal := req.StandardRequest.Header.Get("X-Normal")
59 if normalVal != "static-value" {
60 t.Errorf("X-Normal = %q, want 'static-value'", normalVal)
61 }
62}
63
64func TestBuild_FuzzInBody(t *testing.T) {
65 rc := &RequestConfig{

Callers

nothing calls this directly

Calls 1

BuildMethod · 0.95

Tested by

no test coverage detected