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

Function testHeaders

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

Source from the content-addressed store, hash-verified

262func TestHeaders_module(t *testing.T) { testHeaders(t, nil) }
263func TestHeaders_worker(t *testing.T) { testHeaders(t, &testOptions{workerScript: "headers.php"}) }
264func testHeaders(t *testing.T, opts *testOptions) {
265 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
266 body, resp := testGet(fmt.Sprintf("http://example.com/headers.php?i=%d", i), handler, t)
267
268 assert.Equal(t, "Hello", body)
269 assert.Equal(t, 201, resp.StatusCode)
270 assert.Equal(t, "bar", resp.Header.Get("Foo"))
271 assert.Equal(t, "bar2", resp.Header.Get("Foo2"))
272 assert.Equal(t, "bar3", resp.Header.Get("Foo3"), "header without whitespace after colon")
273 assert.Empty(t, resp.Header.Get("Invalid"))
274 assert.Equal(t, fmt.Sprintf("%d", i), resp.Header.Get("I"))
275 }, opts)
276}
277
278func TestResponseHeaders_module(t *testing.T) { testResponseHeaders(t, nil) }
279func TestResponseHeaders_worker(t *testing.T) {

Callers 2

TestHeaders_moduleFunction · 0.85
TestHeaders_workerFunction · 0.85

Calls 3

runTestFunction · 0.85
testGetFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected