Skip to content

Commit 764bf3b

Browse files
Fix incorrect mime type in JSON error responses
1 parent 617e65e commit 764bf3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/better_errors/middleware.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,22 @@ def no_errors_json_response
178178
"The application has been restarted since this page loaded, " +
179179
"or the framework is reloading all gems before each request "
180180
end
181-
[200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump(
181+
[200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.dump(
182182
error: 'No exception information available',
183183
explanation: explanation,
184184
)]]
185185
end
186186

187187
def invalid_error_json_response
188-
[200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump(
188+
[200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.dump(
189189
error: "Session expired",
190190
explanation: "This page was likely opened from a previous exception, " +
191191
"and the exception is no longer available in memory.",
192192
)]]
193193
end
194194

195195
def invalid_csrf_token_json_response
196-
[200, { "Content-Type" => "text/plain; charset=utf-8" }, [JSON.dump(
196+
[200, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.dump(
197197
error: "Invalid CSRF Token",
198198
explanation: "The browser session might have been cleared, " +
199199
"or something went wrong.",

0 commit comments

Comments
 (0)