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

Problem with request.format #34

Closed
abrisse opened this issue Apr 17, 2013 · 2 comments
Closed

Problem with request.format #34

abrisse opened this issue Apr 17, 2013 · 2 comments

Comments

@abrisse
Copy link
Contributor

abrisse commented Apr 17, 2013

request.format isn't always set with rabl-rails. I had no problem with rabl.

The response header 'Content-Type' is sometimes invalid too. (return text/html instead of application/json during the first request in my app).

Any idea ?

@abrisse
Copy link
Contributor Author

abrisse commented Apr 17, 2013

If I change the following lines :

format.upcase!
Renderers.const_get(format).new(context, locals).render(compiled_template)

to

Renderers.const_get(format.upcase).new(context, locals).render(compiled_template)

It seems to fix the problem that occurs with a Accept: application/json. At the next request, params[:format] equals :JSON instead of :json which causes a 406 Error HTTP (since I use a respond_to :json in my controller)

@abrisse abrisse mentioned this issue Apr 17, 2013
@ccocchi
Copy link
Owner

ccocchi commented Apr 22, 2013

What is the value of your context.params[:format] ? because your change is supposed to do absolutely nothing different..

Can you reproduce this into a small app or within a test ?

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

Successfully merging a pull request may close this issue.

2 participants