Skip to content

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

Closed
exoego/rspec-openapi
#231
@exoego

Description

@exoego

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions