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
lib/goliath/rack/jsonp.rb doesn’t set Content-Type: application/javascript #126
Comments
Likely an oversight / omission on our part. |
The jsonp middleware doesn't actually format the response as JSON. It just warps the jsonp callback around whatever the current response is. You would also need to use the JSON formatter (after jsonp in the list of middlewares). |
@dj2 That is very true, but if you set the content type to |
I'd call that a bug in your application if you're setting the wrong content-type. The json formatter will accept either application/json or application/javascript and format them as JSON. |
Ok, so you think it is better to check if |
I agree, the JSONP middleware should set the appropriate header, which in this case is I wouldn't bake this directly into the JSON middleware, since there is a chance that you may want to use |
If JavaScript is returned (which is what JSONP is), then the content type should be set to application/javascript as per rfc4329.txt.
Is there a reason why
jsonp.rb
doesn’t change the content type?The text was updated successfully, but these errors were encountered: