(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func 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 |
nothing calls this directly
no test coverage detected