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

"Accept" header is not being taken into account #85

Open
icapuccio opened this issue Dec 13, 2018 · 3 comments
Open

"Accept" header is not being taken into account #85

icapuccio opened this issue Dec 13, 2018 · 3 comments

Comments

@icapuccio
Copy link

I wasn't able to get a JSON/XML response using the "Accept" header. The response's content type is always text/plain

The only way right now is through URI extensions. I'm using Rails 5.0.6

screen shot 2018-12-13 at 18 16 32

@ianheggie
Copy link
Collaborator

ianheggie commented May 25, 2021

This looks like an issue with rails itself, as I am using the standard respond_to which according to rails doc https://api.rubyonrails.org/v5.0.6/classes/ActionController/MimeResponds.html :
"(Rails determines the desired response format from the HTTP Accept header submitted by the client.)"

I can reproduce your error using curl as well as the online https://reqbin.com/req/c-vdhoummp/curl-get-json-example test

This makes me curious!

@ianheggie
Copy link
Collaborator

Just checked health_check on an old rails 2.3.18 site, and it has the same issue ... Checked a rails 5.0 site resource index page, and it worked!! (though its using view selection at that point, not responds_to) ...

@ianheggie
Copy link
Collaborator

@icapuccio I have no idea why respond_to is not paying attention to the Accept header. Anyone have an idea?

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

2 participants