app_response is not always a rack response object

This commit is contained in:
tinexw 2015-11-17 00:42:32 +01:00
parent 5c7d8b21a0
commit 7ba0dba6fa
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,11 @@ class Grape::Middleware::Logger < Grape::Middleware::Globals
error = catch(:error) do
begin
@app_response = @app.call(@env)
# Usually a rack response object is returned: https://github.com/ruby-grape/grape/blob/master/UPGRADING.md#changes-in-middleware
# However, rack/auth/abstract/handler.rb still returns an array instead of a rack response object.
if @app_response.is_a?(Array)
@app_response = Rack::Response.new(@app_response[2], @app_response[0], @app_response[1])
end
rescue => e
after_exception(e)
raise e