(t *testing.T, opts *testOptions)
| 191 | testServerVariable(t, &testOptions{workerScript: "server-variable.php"}) |
| 192 | } |
| 193 | func testServerVariable(t *testing.T, opts *testOptions) { |
| 194 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
| 195 | req := httptest.NewRequest("POST", fmt.Sprintf("http://example.com/server-variable.php/baz/bat?foo=a&bar=b&i=%d#hash", i), strings.NewReader("foo")) |
| 196 | req.SetBasicAuth(strings.Clone("kevin"), strings.Clone("password")) |
| 197 | req.Header.Add(strings.Clone("Content-Type"), strings.Clone("text/plain")) |
| 198 | body, _ := testRequest(req, handler, t) |
| 199 | |
| 200 | assert.Contains(t, body, "[REMOTE_HOST]") |
| 201 | assert.Contains(t, body, "[REMOTE_USER] => kevin") |
| 202 | assert.Contains(t, body, "[PHP_AUTH_USER] => kevin") |
| 203 | assert.Contains(t, body, "[PHP_AUTH_PW] => password") |
| 204 | assert.Contains(t, body, "[HTTP_AUTHORIZATION] => Basic a2V2aW46cGFzc3dvcmQ=") |
| 205 | assert.Contains(t, body, "[DOCUMENT_ROOT]") |
| 206 | assert.Contains(t, body, "[PHP_SELF] => /server-variable.php/baz/bat") |
| 207 | assert.Contains(t, body, "[CONTENT_TYPE] => text/plain") |
| 208 | assert.Contains(t, body, fmt.Sprintf("[QUERY_STRING] => foo=a&bar=b&i=%d#hash", i)) |
| 209 | assert.Contains(t, body, fmt.Sprintf("[REQUEST_URI] => /server-variable.php/baz/bat?foo=a&bar=b&i=%d#hash", i)) |
| 210 | assert.Contains(t, body, "[CONTENT_LENGTH]") |
| 211 | assert.Contains(t, body, "[REMOTE_ADDR]") |
| 212 | assert.Contains(t, body, "[REMOTE_PORT]") |
| 213 | assert.Contains(t, body, "[REQUEST_SCHEME] => http") |
| 214 | assert.Contains(t, body, "[DOCUMENT_URI]") |
| 215 | assert.Contains(t, body, "[AUTH_TYPE]") |
| 216 | assert.Contains(t, body, "[REMOTE_IDENT]") |
| 217 | assert.Contains(t, body, "[REQUEST_METHOD] => POST") |
| 218 | assert.Contains(t, body, "[SERVER_NAME] => example.com") |
| 219 | assert.Contains(t, body, "[SERVER_PROTOCOL] => HTTP/1.1") |
| 220 | assert.Contains(t, body, "[SCRIPT_FILENAME]") |
| 221 | assert.Contains(t, body, "[SERVER_SOFTWARE] => FrankenPHP") |
| 222 | assert.Contains(t, body, "[REQUEST_TIME_FLOAT]") |
| 223 | assert.Contains(t, body, "[REQUEST_TIME]") |
| 224 | assert.Contains(t, body, "[SERVER_PORT] => 80") |
| 225 | }, opts) |
| 226 | } |
| 227 | |
| 228 | func TestPathInfo_module(t *testing.T) { testPathInfo(t, nil) } |
| 229 | func TestPathInfo_worker(t *testing.T) { |
no test coverage detected