Skip to content
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

Content type header gets stomped #6

Closed
myronmarston opened this issue May 25, 2010 · 2 comments
Closed

Content type header gets stomped #6

myronmarston opened this issue May 25, 2010 · 2 comments

Comments

@myronmarston
Copy link

I tried setting the Content-Type header like so:

header 'Content-Type', 'application/json'
get 'some/path'

However, rack-test stomps the content type header. First, #headers_for_environment converts it to HTTP_CONTENT_TYPE. Then #env_for sets the content type to application/x-www-form-urlencoded here. Since my content type header was converted to HTTP_CONTENT_TYPE, CONTENT_TYPE has no value and the ||= stomps it.

I'm willing to take a crack at fixing it and submitting a patch, but I'm not sure of the reason for the conversion to HTTP_CONTENT_TYPE. What's the best way to fix this?

@brynary
Copy link
Collaborator

brynary commented May 26, 2010

Good catch. Fixed in master.

@gonzofy
Copy link

gonzofy commented Sep 19, 2012

Any chance this is still a problem on 0.6.1? I'm using:

header "Content-Type", "application/json"

but seeing in Controller.request that @_headers is still "Content-Type: text/html"

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants