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

Function TestAllCommonHeadersAreCorrect

internal/phpheaders/phpheaders_test.go:15–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestAllCommonHeadersAreCorrect(t *testing.T) {
16 fakeRequest := httptest.NewRequest("GET", "http://localhost", nil)
17
18 for header, phpHeader := range CommonRequestHeaders {
19 // verify that common and uncommon headers return the same result
20 expectedPHPHeader := GetUnCommonHeader(t.Context(), header)
21 assert.Equal(t, phpHeader+"\x00", expectedPHPHeader, "header is not well formed: "+phpHeader)
22
23 // net/http will capitalize lowercase headers, verify that headers are capitalized
24 fakeRequest.Header.Add(header, "foo")
25 assert.Contains(t, fakeRequest.Header, header, "header is not correctly capitalized: "+header)
26 }
27}
28
29// Go's net/http server rejects header names containing spaces with a 400 response
30// before the request reaches the handler, so headerNameReplacer does not need to

Callers

nothing calls this directly

Calls 1

GetUnCommonHeaderFunction · 0.85

Tested by

no test coverage detected