| 62 | } |
| 63 | |
| 64 | func 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 | |
| 83 | func TestBuild_FuzzInQuery(t *testing.T) { |
| 84 | rc := &RequestConfig{ |