You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Content-Type header is lost when using the built in HTTP Basic Auth.
After the initial redirect response is followed, $request->getContentType() returns null.
Also, when inspecting the $_SERVER superglobal, the 'Content-Type' is no longer there.
When inspecting $_SERVER at the intial request (the one returning the redirect as part of the basic auth), the Content-Type is still there.
create a Controller that is behind the basic auth firewall and:
/**
* @Route("/testapi", methods={Request::METHOD_GET})
*/
public function getAllAction(string $resourceType, Request $request): Response
{
var_dump($request->getContentType());
var_dump($_SERVER);
die;
}
use Postman to call /testapi
Possible Solution
no suggestions, as i'm not sure where this is going wrong.
Additional context
I'm using postman to call my endpoint and set the request header, and i was considering the option that postman could be the issue here. However, when using the Postman Console it shows me the 2 separate requests as part of the basic auth, and the second request still has the Content-Type header that I filled in. Also, if I add any other custom header (i.e. X-FOOBAR), it IS available when i dump it from my controller after logging in, so the exception seems to be specifically on the Content-Type header.
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected: 4.4.x
Description
Content-Type header is lost when using the built in HTTP Basic Auth.
After the initial redirect response is followed,
$request->getContentType()
returnsnull
.Also, when inspecting the $_SERVER superglobal, the 'Content-Type' is no longer there.
When inspecting $_SERVER at the intial request (the one returning the redirect as part of the basic auth), the Content-Type is still there.
How to reproduce
Possible Solution
no suggestions, as i'm not sure where this is going wrong.
Additional context
I'm using postman to call my endpoint and set the request header, and i was considering the option that postman could be the issue here. However, when using the Postman Console it shows me the 2 separate requests as part of the basic auth, and the second request still has the Content-Type header that I filled in. Also, if I add any other custom header (i.e. X-FOOBAR), it IS available when i dump it from my controller after logging in, so the exception seems to be specifically on the
Content-Type
header.The text was updated successfully, but these errors were encountered: