File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 55# The original source needs to be patched, so that Inertia requests are
66# NOT responded with plain text, but with HTML.
77#
8- # Original source (unchanged since Rails 5.1):
9- # https://github.com/rails/rails/blob/5-1-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
8+ # Original source:
109# https://github.com/rails/rails/blob/8-0-stable/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
10+ # https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
1111#
1212
1313module InertiaRails
1414 module InertiaDebugExceptions
15- def render_for_browser_request ( request , wrapper )
15+ # Rails 8.2+ passes content_type as third argument
16+ def render_for_browser_request ( request , wrapper , content_type = nil )
1617 template = create_template ( request , wrapper )
1718 file = "rescues/#{ wrapper . rescue_template } "
1819
19- if request . xhr? && !request . headers [ 'X-Inertia' ] # <<<< this line is changed only
20+ if content_type == Mime [ :md ]
21+ body = template . render ( template : file , layout : false , formats : [ :text ] )
22+ format = 'text/markdown'
23+ elsif request . xhr? && !request . headers [ 'X-Inertia' ]
2024 body = template . render ( template : file , layout : false , formats : [ :text ] )
2125 format = 'text/plain'
2226 else
You can’t perform that action at this time.
0 commit comments