(t *testing.T, opts *testOptions)
| 280 | testResponseHeaders(t, &testOptions{workerScript: "response-headers.php"}) |
| 281 | } |
| 282 | func testResponseHeaders(t *testing.T, opts *testOptions) { |
| 283 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
| 284 | body, resp := testGet(fmt.Sprintf("http://example.com/response-headers.php?i=%d", i), handler, t) |
| 285 | |
| 286 | if i%3 != 0 { |
| 287 | assert.Equal(t, i+100, resp.StatusCode) |
| 288 | } else { |
| 289 | assert.Equal(t, 200, resp.StatusCode) |
| 290 | } |
| 291 | |
| 292 | assert.Contains(t, body, "'X-Powered-By' => 'PH") |
| 293 | assert.Contains(t, body, "'Foo' => 'bar',") |
| 294 | assert.Contains(t, body, "'Foo2' => 'bar2',") |
| 295 | assert.Contains(t, body, fmt.Sprintf("'I' => '%d',", i)) |
| 296 | assert.NotContains(t, body, "Invalid") |
| 297 | }, opts) |
| 298 | } |
| 299 | |
| 300 | func TestInput_module(t *testing.T) { testInput(t, nil) } |
| 301 | func TestInput_worker(t *testing.T) { testInput(t, &testOptions{workerScript: "input.php"}) } |
no test coverage detected