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

Recognize_path should account for HTTP method #2415

Open
ideaoforder opened this issue Feb 23, 2024 · 1 comment
Open

Recognize_path should account for HTTP method #2415

ideaoforder opened this issue Feb 23, 2024 · 1 comment

Comments

@ideaoforder
Copy link

In a RESTful API, you'll use the same path multiple times, but with a different REST verb.

These will return the same endpoint:

  • GET /orders
  • POST /orders

So will these:

  • GET /orders/123
  • PUT /orders/123
  • DELETE /orders/123

Ideally, we'd be able to pass that in as an option:

API.recognize_path('/orders/123', method: 'PUT')
@dblock
Copy link
Member

dblock commented Feb 24, 2024

Indeed. I am actually kinda surprised it doesn't. Start by writing a spec that (fails to) differentiate(s) multiple methods on the same API. What do we return today? The first matching route? In which case I think we should consider making this recognize_path(path, verb = 'GET') vs. adding an options hash. What other options would make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants