Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

The method resetHttpHeaders removes SCRIPT_FILENAME from the headers #232

Open
NicolasDievart opened this issue Dec 14, 2017 · 1 comment

Comments

@NicolasDievart
Copy link

Hi,

I wanted to update from 2.7.1 to 3.0.1 today, and by doing so, I am facing fail in my test suite.
I have a suite of scenario that are doing GET/POST request and I check the responses status and responses body.
In 2.8.0, you introduce the resetHttpHeaders between requests which seems to be quite natural.
However, this methods cleans all the headers (except the HTTP_USER_AGENT which is hard setted by BrowserKit/Client), even the SCRIPT_FILENAME header added from the base_url option in the BrowserKitDriver of Mink.

My first request hit without problem and this scenario passes, but my next one fails as it does not have the header "SCRIPT_FILENAME" => "/app_test.php".

I tried to re-add the header before the request via the context: I add :name header equal to :value, but it forces the HTTP_ prefix, so I can not add the SCRIPT_FILENAME header anymore.

I may be missing something there, as I can not found a workaround on this except maybe split my scenarios into multiple features which I would like to avoid.

@jdeniau
Copy link
Contributor

jdeniau commented Feb 13, 2018

I have the same behaviour when upgrading from 2.7.1 to 2.8.0 or 2.8.1 and I diagnose the same thing (a call to resetHttpHeaders introduced by 4cc6cfc ).

The impacted header for me is Authorization, which is quite annoying to reset on every http call as you can imagine :p .

As I understand the purpose of the fix, maybe we can find an issue to allow user to set temporary or "permanent headers ?

Maybe two different command:

Given I add the foo header equal to bar # if you think headers should be temporary
Given I add the foo permanent header equal to bar

or

Given I add the foo header equal to bar # if you think headers should be permanent
Given I add the foo temporary header equal to bar

Thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants