You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Error:
Body parsing#test_0002_is successful (JSON) with an array:
TypeError: no implicit conversion of Array into Hash
/Users/weppos/Mirrors/hanami--router/lib/hanami/routing/parsers.rb:49:in `merge!'
/Users/weppos/Mirrors/hanami--router/lib/hanami/routing/parsers.rb:49:in `block in _redefine_call'
/Users/weppos/Mirrors/hanami--router/lib/hanami/routing/http_router.rb:135:in `raw_call'
/Users/weppos/.rvm/gems/ruby-2.3.0/gems/http_router-0.11.2/lib/http_router.rb:142:in `call'
/Users/weppos/Mirrors/hanami--router/lib/hanami/router.rb:931:in `call'
/Users/weppos/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/lint.rb:49:in `_call'
/Users/weppos/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/lint.rb:37:in `call'
/Users/weppos/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/mock.rb:74:in `request'
/Users/weppos/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/mock.rb:59:in `patch'
/Users/weppos/Mirrors/hanami--router/test/integration/body_parsing_test.rb:27:in `block (2 levels) in <top (required)>'
it'is successful (JSON) with an array'dobody=StringIO.new(%(["alpha", "beta"]).encode(Encoding::ASCII_8BIT))response=@app.patch('/books/23','CONTENT_TYPE'=>'application/json','rack.input'=>body,lint: true)response.status.must_equal200response.body.must_equal%(["alpha", "beta"])end
I was able to reproduce the error here.
This is an example of a request
Of course, the tricky part is how this case should be handled in the
params
as it implies theparams
can also be anArray
, instead of always aHash
.It's possible to use a constant key, for example
_
, which is also the same approach Rails is following.In this case, Rails uses the
_json
key.FYI, Lotus crashes at this point, because
merge!
can't handle an input which is not aHash
.The text was updated successfully, but these errors were encountered: