Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

rework passing headers and env variables in integration tests #9700

Merged
merged 4 commits into from Mar 13, 2013

Conversation

Projects
None yet
3 participants
Member

senny commented Mar 13, 2013

As discussed this is a rework to support both HTTP headers and CGI env variables in the integration testing API.

I refactored Http::Headers to always store the variables in CGI format internally. The data can be accessed using both formats and the integration testing API no makes use of Http::Headers.

Since not all headers are prefixed with "HTTP_" in the env format I had to add a whitelist. I don't think the whitelist is complete so please let me know if I should add more.

This solves the problem described in #6513

Member

senny commented Mar 13, 2013

@pixeltrix @jeremy let me know what you think.

@pixeltrix pixeltrix added a commit that referenced this pull request Mar 13, 2013

@pixeltrix pixeltrix Merge pull request #9700 from senny/6513_integration_test_headers
rework passing headers and env variables in integration tests
0248267

@pixeltrix pixeltrix merged commit 0248267 into rails:master Mar 13, 2013

@senny senny deleted the senny:6513_integration_test_headers branch Mar 13, 2013

@senny senny added a commit to senny/rails that referenced this pull request Mar 15, 2013

@senny senny `Http::Headers` directly modifies the passed environment.
The env hash passed to `Http::Headers#new` must be in env format.
Also be aware that the passed hash is modified directly.

docs and test-cases for setting headers/env in functional tests.

Follow up to #9700.
41a14dc
Contributor

jaredbeck commented Feb 8, 2014

We could use a bit more guidance in the Guide to Testing Rails Applications - Section 4.5 Setting Headers and CGI variables. It's not clear, for example, when to use the HTTP prefix, or what case to use, or dashes vs. underscores. Maybe there is some w3c spec we could point to, I don't know.

Contributor

jaredbeck commented Feb 8, 2014

I think I'm just missing some fundamental distinction between an HTTP header and a CGI variable.

@senny senny added a commit that referenced this pull request Feb 10, 2014

@senny senny docs, link to HTTP and CGI header definitions. [ci skip]
This was a reaction to: #9700 (comment)
3b868cc
Member

senny commented Feb 10, 2014

@jaredbeck the section now links the relevant RFC sections: 3b868cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment