-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
+server.js
endpoints do not correctly return the allow
header
#8967
Comments
5 tasks
dummdidumm
pushed a commit
that referenced
this issue
Feb 9, 2023
5 tasks
dummdidumm
pushed a commit
that referenced
this issue
Apr 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
A list of allowed methods should be returned when making an invalid request to an endpoint.
However, no exported methods are being included in the
allow
header.kit/packages/kit/src/runtime/server/utils.js
Line 44 in 51cd6e6
The issue stems from the
in
keyword comparing the index numbers instead of the http methods in the array. It should use theof
keyword instead.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-v8r3ub?file=src%2Froutes%2F%2Bpage.svelte,src%2Froutes%2Ftest%2F%2Bserver.js&terminal=dev
Make a request to
/test
with a method that is not allowed such asPUT
Expected:
Response's
allow
header includesPOST
.Actual:
Response's
allow
header is empty.Logs
#### Browser console Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: