-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
allow overriding Content-Type in response #97
Comments
I haven't tried with content-type (it may be overwritten somewhere, in which case you'll need to do some work not to), but we append a last-modified header like this.
The header method comes from endpoint.rb, hasn't been documented, but I don't see why not. It would be nice if someone (you?) wrote a test for this and content-type and added it to the doc.
|
I actually ran into this myself recently...right now the Grape formatter may well override your |
We've implemented this by mime-type. This remains a valid feature request to allow to override the content-type in the API implementation itself. For example you fetch |
Have there been any updates on this feature? I'm running into the problem of serving up both json and jsonp responses (if a callback is given). I want to keep the API default format as application/json, but would also like to be able to serve application/javascript for jsonp needs on API requests that contain params[:callback]. Any workarounds for this? I'm using grape within a Rails 3.2.6 application. |
I made a pull request, #202. |
I think that maybe a cleaner solution for the JSONP problem, specifically, is to add a proper content-type for Otherwise, I believe the rack middleware described in #28 just does it. |
Thank you. I agree with you on the cleaner solution. I'm using the middleware, but am presenting via Rabl templates. Rabl is looking for the format defined in my Grape setup. I'm guessing that using Grape/Rabl may be causing a bit of the problem as well. |
Implements #97: allow overriding Content-Type.
#202 was merged, fyi |
Thank you so much. |
How can I override Grape's choice of the Content-Type header in the response? (perhaps this should be added to the README). thanks
The text was updated successfully, but these errors were encountered: