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

Function testRejectInvalidHeaders

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

Source from the content-addressed store, hash-verified

1037 testRejectInvalidHeaders(t, &testOptions{workerScript: "headers.php"})
1038}
1039func testRejectInvalidHeaders(t *testing.T, opts *testOptions) {
1040 invalidHeaders := [][]string{
1041 {"Content-Length", "-1"},
1042 {"Content-Length", "something"},
1043 }
1044 for _, header := range invalidHeaders {
1045 runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, _ int) {
1046 req := httptest.NewRequest("GET", "http://example.com/headers.php", nil)
1047 req.Header.Add(header[0], header[1])
1048 body, resp := testRequest(req, handler, t)
1049
1050 assert.Equal(t, 400, resp.StatusCode)
1051 assert.Contains(t, body, "invalid")
1052 }, opts)
1053 }
1054}
1055
1056func TestFlushEmptyResponse_module(t *testing.T) { testFlushEmptyResponse(t, &testOptions{}) }
1057func TestFlushEmptyResponse_worker(t *testing.T) {

Calls 2

runTestFunction · 0.85
testRequestFunction · 0.85

Tested by

no test coverage detected