-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I'm wondering if we should be setting the Content-Type response header for JsonapiErrorable#handle_exception and JsonapiErrorable::Validatable#render_errors_for. In our app we've overwritten those two methods in our base API controller to look something like this:
# Override JsonapiErrorable#handle_exception to ensure correct content type
def handle_exception(*)
self.content_type ||= Mime[:jsonapi]
super
end
private
# Override JsonapiErrorable::Validatable to ensure correct content type
def render_errors_for(*)
self.content_type ||= Mime[:jsonapi]
super
endHere we're relying on the Mime::Type being registered - which we're getting by way of jsonapi-rails, which registers it in their Railtie. https://github.com/jsonapi-rb/jsonapi-rails/blob/14a9421658495fe916ec1886834b6adfd764b211/lib/jsonapi/rails/railtie.rb#L34-L36
But this gem could do something similar. Is there a reason not to?
Metadata
Metadata
Assignees
Labels
No labels