Created
January 7, 2009 13:26
-
-
Save bdotdub/44276 to your computer and use it in GitHub Desktop.
Patch for Sinatra bug that responds with the correct error code. From: http://github.com/bdotdub/sinatra/commit/7d9569c062501abae85570041710eced883ebee6 Re: http://groups.google.com/group/sinatrarb/browse_thread/thread/93aa2e2bcb0eefb5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/lib/sinatra.rb | |
+++ b/lib/sinatra.rb | |
@@ -1260,7 +1260,8 @@ module Sinatra | |
request.env['rack.errors'] << msg | |
request.env['sinatra.error'] = e | |
- context.status(500) | |
+ status = e.class.respond_to?(:code) ? e.class.code : 500 | |
+ context.status(status) | |
raise if options.raise_errors && e.class != NotFound | |
result = (errors[e.class] || errors[ServerError]).invoke(request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment