lib/prop/middleware.rb in prop-0.7.1 vs lib/prop/middleware.rb in prop-0.7.2
- old
+ new
@@ -4,11 +4,11 @@
# as time left before the current window has passed in a Retry-After header.
class Middleware
# Default error handler
class DefaultErrorHandler
- def self.call(error)
+ def self.call(env, error)
body = error.description || "This action has been rate limited"
headers = { "Content-Type" => "text/plain", "Content-Length" => body.size, "Retry-After" => error.retry_after }
[ 429, headers, [ body ]]
end
@@ -22,10 +22,10 @@
def call(env)
begin
@app.call(env)
rescue Prop::RateLimited => e
- @handler.call(e)
+ @handler.call(env, e)
end
end
end
end