lib/roda/plugins/exception_page.rb in roda-3.69.0 vs lib/roda/plugins/exception_page.rb in roda-3.70.0
- old
+ new
@@ -196,20 +196,20 @@
# Designed to be used with the +json+ exception, which will
# automatically convert the hash to JSON format.
def exception_page(exception, opts=OPTS)
message = exception_page_exception_message(exception)
if opts[:json]
- @_response['Content-Type'] = "application/json"
+ @_response[RodaResponseHeaders::CONTENT_TYPE] = "application/json"
{
"exception"=>{
"class"=>exception.class.to_s,
"message"=>message,
"backtrace"=>exception.backtrace.map(&:to_s)
}
}
elsif env['HTTP_ACCEPT'] =~ /text\/html/
- @_response['Content-Type'] = "text/html"
+ @_response[RodaResponseHeaders::CONTENT_TYPE] = "text/html"
context = opts[:context] || 7
css_file = opts[:css_file]
js_file = opts[:js_file]
@@ -392,11 +392,11 @@
#{js}
</body>
</html>
END
else
- @_response['Content-Type'] = "text/plain"
+ @_response[RodaResponseHeaders::CONTENT_TYPE] = "text/plain"
"#{exception.class}: #{message}\n#{exception.backtrace.map{|l| "\t#{l}"}.join("\n")}"
end
end
# The CSS to use on the exception page
@@ -427,14 +427,14 @@
module RequestMethods
# Serve exception page assets
def exception_page_assets
get 'exception_page.css' do
- response['Content-Type'] = "text/css"
+ response[RodaResponseHeaders::CONTENT_TYPE] = "text/css"
scope.exception_page_css
end
get 'exception_page.js' do
- response['Content-Type'] = "application/javascript"
+ response[RodaResponseHeaders::CONTENT_TYPE] = "application/javascript"
scope.exception_page_js
end
end
end
end