-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
No way to override the Content-Type header in Browserkit Request #20042
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
Comments
@Pherserk can you try
However at first sight your version should work too based on
Can you debug where stuff gets lost? |
Just added a failing test on this fork at line 167 But due to the nature of the mock TestClient, I think it is not reliable. |
@ro0NL Just to be more precise, I'm developing a Json Api user management util. I use to validate Json Api request with this validator: And I'm testing controllers using this util: This is an example usage of this test util at line 37 Many, many thanks. |
From your issue i kinda assumed you were using Next your Im lost.. what exactly is the issue? |
@ro0NL $this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content); $this->request = $this->filterRequest($this->internalRequest); if I dump the internalRequest, it preserves the content-type header, while request, does override it with the "application/x--www-form-urlencoded" value. |
This is guessing.. i can have a look tonight maybe. But by default the request is not filtered.. ie |
@xabbuh i think we can close this issue, |
@xabbuh @javiereguiluz @ro0NL
this should works |
Closing because this should work as explained by @petertanath. @ro0NL thanks for your help here too. |
Can confirm that this works as expected:
|
Maybe this will help us symfony/browser-kit#10 |
Making a request with the method request() will always override the content-type header, with application/x-www-form-urlencoded.
Example to reproduce the problem
the request sent to the controller will contain application/x--www-form-urlencoded
Also trying with:
The text was updated successfully, but these errors were encountered: