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 617e65e commit 764bf3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/better_errors/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,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 764bf3b

Please sign in to comment.