From 764bf3b20bea70006575aa6fbd94bb18cf8080ec 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 6eee8b4d..dac2ae5c 100644 --- a/lib/better_errors/middleware.rb +++ b/lib/better_errors/middleware.rb @@ -178,14 +178,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.", @@ -193,7 +193,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.",