Skip to content

Commit

Permalink
Fix incorrect mime type in JSON error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDaugherty committed Sep 13, 2020
1 parent f8a4edc commit 901f724
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/better_errors/middleware.rb
Expand Up @@ -177,22 +177,22 @@ 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.",
)]]
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.",
Expand Down

0 comments on commit 901f724

Please sign in to comment.