-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[BrowserKit]Cannot set Custom Header #5074
Comments
headers are also part of |
Thanks stof. This can be closed. In my case, I am using a custom header "X-Session-Token". In the testing code, it can be send as "HTTP_X_SESSION_TOKEN":
And the following code works fine on server side:
|
I still consider this an issue. Why don't you call |
I still consider this an issue too. There should be an parameter for the header array. |
I just spent 3 hours trying to figure out why the headers I set weren't making it to the request object. Quite annoying. |
+1. I've been setting |
I also think this is still an issue, is this documented anywhere except here? |
@rayrutjes Please open an issue in the docs repository if you think that we can improve the documentation in a way. |
+1 |
1 similar comment
+1 |
I do agree. Moreover, this is not documented. |
I spent a couple of hours to find out why request didn't contain my token ... oh |
Same story - one hour researching why headers are not used... prefixed with |
…nt must have HTTP_ prefix (Ferror) This PR was submitted for the 5.x branch but it was merged into the 4.4 branch instead. Discussion ---------- [Testing] Every custom header in functional testing client must have HTTP_ prefix <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Due to symfony/symfony#5074 issue, I would propose to add a simple caution block with information, that the `HTTP_` prefix is mandatory - it will save some hours for others. Commits ------- 8e5d9bc Every custom header in testing client must have HTTP prefix
only worked for me after adding HTTP_ as prefix |
My case with
ps |
For those wondering why "Authorization" is more "custom" than Content_type, actually it's more that EVERY header except https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/BrowserKit/HttpBrowser.php#L118 |
Hi,
I noticed the Client::request() function doesn't support pass custom header. It can only set $_SERVER, but not headers directly.
It is exactly the same problem as mentioned here: http://stackoverflow.com/questions/11549672/symfony-functional-test-custom-headers-not-passing-through
Thanks,
Wei
The text was updated successfully, but these errors were encountered: