Sha256: 5f9e742ae6be10589be724e1f6e897420e0562c36dc2a73858399d6e43a8ffc7
Contents?: true
Size: 594 Bytes
Versions: 39
Compression:
Stored size: 594 Bytes
Contents
# https://guides.rubyonrails.org/configuring.html#config-exceptions-app module PandaCms class ExceptionsApp def initialize(exceptions_app:) @exceptions_app = exceptions_app end def call(env) request = ActionDispatch::Request.new(env) fallback_to_html_format_if_invalid_mime_type(request) @exceptions_app.call(env) end private def fallback_to_html_format_if_invalid_mime_type(request) request.formats rescue ActionDispatch::Http::MimeNegotiation::InvalidType request.set_header "CONTENT_TYPE", "text/html" end end end
Version data entries
39 entries across 39 versions & 1 rubygems