jpbuilder icon indicating copy to clipboard operation
jpbuilder copied to clipboard

Content Type

Open infinite-monkeys opened this issue 9 years ago • 2 comments

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?

infinite-monkeys avatar Jun 10 '15 00:06 infinite-monkeys

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.

joakimk avatar Jul 01 '15 15:07 joakimk

Thanks. I think we ended up finding a different way to get what we wanted (requesting foo.js instead of foo.json)

infinite-monkeys avatar Jul 09 '15 22:07 infinite-monkeys