-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Issue with trailing slash redirect #89
Comments
@faizan-glitch For this case, you can just omit the slash.
Like this. |
@aikchun yes, i realize that i can omit the trailing slash, but that is not the expected behaviour, because I cannot make sure that the frontend devs will always omit it. As of now I have added two seperate routes, one with the trailing slash another without the trailing slash to get around this. but it is very weird. is there any particular reason why Bunrouter by default redirects towards GET instead of whatever is the correct HTTP method? |
I am not sure myself. I was looking to contribute to the project through your issue so I am kinda new to the project and contributing to OSS in general. It does seem like it is handling trailing slashes in a way, I'm just not sure how. |
BunRouter is redirecting a POST request without a trailing to the GET Handler
I have the following code
If i send a POST request to /accounts/ then it works perfectly fine
But if send a POST request to /accounts then it redirects to GET /accounts
I have attached some screenshots below
As it can be seen that it works fine if i have a trailing slash
but if I remove the trailing slash I get this
Notice how I get method not allowed that is because I am getting redirected to a GET handler for /accounts/ which doesn't exists
POST Request to /accounts should get redirected to POST handler of /accounts/ instead of GET handler of /accounts
P.S: I am using bunrouter v1.0.20
The text was updated successfully, but these errors were encountered: