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
API Route precedence isn't working correctly when using two files in a directory such as
resource/$resourceId.ts - implements a GET method
resource/batch.ts - implements a POST method that takes a payload with a list of resource ids to fetch in bulk.
When you call POST /resource/batch you get back a 405 method not allowed error instead of the expected 200.
Your Example Website or App
None, discussed in discord
Steps to Reproduce the Bug or Issue
Add route using createAPIFileRoute at /resource/$resourceId.ts with a GET handler.
Add route using createAPIFileRoute at /resource/batch.ts with a POST handler.
Call POST /resource/batch and get back a 405.
Expected behavior
I should get back a 200 because POST /resource/batch exactly matches a defined route which should take precedence over a parameterized route.
Screenshots or Videos
No response
Platform
OS: macOS
Browser: Chrome and curl
Version: v133
Additional context
I'm submitting this bug report after a conversation with Manuel in the Discord #start channel today, where he helped me figure out why i was getting a 405 method not allowed when calling an endpoint that was defined.
The text was updated successfully, but these errors were encountered:
Which project does this relate to?
Start
Describe the bug
API Route precedence isn't working correctly when using two files in a directory such as
resource/$resourceId.ts
- implements a GET methodresource/batch.ts
- implements a POST method that takes a payload with a list of resource ids to fetch in bulk.When you call
POST /resource/batch
you get back a 405 method not allowed error instead of the expected 200.Your Example Website or App
None, discussed in discord
Steps to Reproduce the Bug or Issue
/resource/$resourceId.ts
with aGET
handler./resource/batch.ts
with aPOST
handler.POST /resource/batch
and get back a 405.Expected behavior
I should get back a 200 because
POST /resource/batch
exactly matches a defined route which should take precedence over a parameterized route.Screenshots or Videos
No response
Platform
Additional context
I'm submitting this bug report after a conversation with Manuel in the Discord #start channel today, where he helped me figure out why i was getting a 405 method not allowed when calling an endpoint that was defined.
The text was updated successfully, but these errors were encountered: