jpbuilder
jpbuilder copied to clipboard
Content Type
Is there an easy way to use this gem such that if the callback is specified, we return a Content-Type of Mime::JS instead of Mime::JSON?
A quick workaround for this in case anyone wants it.
before_filter :set_content_type_for_jsonp_requests
def set_content_type_for_jsonp_requests
is_jsonp = params[:callback]
if is_jsonp
response.headers["Content-Type"] = "application/javascript"
end
end
The proper fix is probably to stop using this library since it does not seem to be maintained anymore.
Thanks. I think we ended up finding a different way to get what we wanted (requesting foo.js instead of foo.json)