From 901f72458cfbd3fc2f160722fb306a6c09cf75d0 Mon Sep 17 00:00:00 2001 From: Robin Daugherty Date: Sun, 13 Sep 2020 10:25:00 -0400 Subject: [PATCH] Fix incorrect mime type in JSON error responses --- lib/better_errors/middleware.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/better_errors/middleware.rb b/lib/better_errors/middleware.rb index b8cc1c91..86c21f9c 100644 --- a/lib/better_errors/middleware.rb +++ b/lib/better_errors/middleware.rb @@ -177,14 +177,14 @@ def no_errors_json_response "The application has been restarted since this page loaded, " + "or the framework is reloading all gems before each request " end - [200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump( + [200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.dump( error: 'No exception information available', explanation: explanation, )]] end def invalid_error_json_response - [200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump( + [200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.dump( error: "Session expired", explanation: "This page was likely opened from a previous exception, " + "and the exception is no longer available in memory.", @@ -192,7 +192,7 @@ def invalid_error_json_response end def invalid_csrf_token_json_response - [200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump( + [200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.dump( error: "Invalid CSRF Token", explanation: "The browser session might have been cleared, " + "or something went wrong.",