Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with grape 0.12 #6

Closed
dmitry opened this issue Jun 23, 2015 · 2 comments
Closed

Not working with grape 0.12 #6

dmitry opened this issue Jun 23, 2015 · 2 comments

Comments

@dmitry
Copy link

dmitry commented Jun 23, 2015

After upgrading I see:

NoMethodError (undefined method `downcase' for 2:Fixnum)

An issue that response method tries to get an array values from @app_response, but it can't because @app_response stores Rack::Response instead of an array.

Don't know yet how to fix that issue, any suggestion can be helpful and transformed into a PR.

@jgeggatt
Copy link

@dmitry I don't totally understand what's going on, but it seems that Grape Middleware is trying to convert the @app_response object into a Rack::Response, but as you mentioned, @app_response is already a Rack::Response, so the error gets raised. To me, this seems like a problem on the Grape side, because I can't find anything that grape_logging is doing to futz with the @app_response value (that gets set from @app.call). So to get around it:

module Grape
  module Middleware
    class Base
      def response
        return @app_response if @app_response.is_a?(Rack::Response)
        super
      end
    end
  end
end

@dmitry
Copy link
Author

dmitry commented Jun 25, 2015

@jgeggatt thank you for helping me. Just pushed fix to the grape.

@dmitry dmitry closed this as completed Jun 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants