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

Router.recognize sets GET to the verb of POST routes #271

Closed
exoego opened this issue Apr 22, 2024 · 0 comments · Fixed by exoego/rspec-openapi#231
Closed

Router.recognize sets GET to the verb of POST routes #271

exoego opened this issue Apr 22, 2024 · 0 comments · Fixed by exoego/rspec-openapi#231

Comments

@exoego
Copy link

exoego commented Apr 22, 2024

I have a router something like:

get '/images', to: 'images.index'
post '/images', to: 'images.upload'

get '/images/:id', to: 'images.show'
post '/images/bulk', to: 'images.upload'

My tool analyses Hanami apps using router.recognize.
I noticed that recognize method returns a RecognizedRoute whose verb is always GET even for POST or other methods.

route = router.recognize("/images/bulk", method: "POST")
expect(route.routable?).to be(true)
expect(route.verb).to eq("POST") # => GET returned 😱 

Repro

Clone #270
And run bundle exec rspec.

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

Successfully merging a pull request may close this issue.

1 participant