-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure headers are consistent #11
Comments
Glad that the issue is being addressed. This caused me some headache when passing a modified Slim request object from the environment to a Guzzle client and the headers with HTTP_ prefix got lost. A workaround is to reset the original keys, using reflection: private function resetHeaderOriginalKeys(Request $request): void
{
$headersProperty = new \ReflectionProperty(Request::class, 'headers');
$headersProperty->setAccessible(true);
/** @var Headers $headers */
$headers = $headersProperty->getValue($request);
foreach ($headers as $key => $header) {
$headers->set($key, $header['value']);
}
$headersProperty->setAccessible(false);
} |
Here is your code in a middleware: https://gist.github.com/sridesmet/a3e0a6f3a3515aaf5d5b4b42479e8c67 |
getHeader()
andgetHeaders()
are consistent. See GetHeaders and GetHeader have a different result Slim#2400Migrated from slimphp/Slim-Http#61
The text was updated successfully, but these errors were encountered: