MCPcopy Index your code
hub / github.com/php/frankenphp / testResponseHeaders

Function testResponseHeaders

frankenphp_test.go:282–298  ·  view source on GitHub ↗
(t *testing.T, opts *testOptions)

Source from the content-addressed store, hash-verified

280 testResponseHeaders(t, &testOptions{workerScript: "response-headers.php"})
281}
282func 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
300func TestInput_module(t *testing.T) { testInput(t, nil) }
301func TestInput_worker(t *testing.T) { testInput(t, &testOptions{workerScript: "input.php"}) }

Callers 2

Calls 2

runTestFunction · 0.85
testGetFunction · 0.85

Tested by

no test coverage detected