-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
POST request fails in Astro.js API route #534
Comments
Your code looks fine to me. We can narrow down the problem a little bit if you try each of these and tell me what happens:
const response = await ky.post( 'http://127.0.0.1:8055/auth/login', {
json: {
email: body.email,
password: body.password
},
} )
const response = await ky.post( 'http://127.0.0.1:8055/auth/login', {
body: JSON.stringify({
email: body.email,
password: body.password
}),
} ).json()
const response = await ky.post( 'http://127.0.0.1:8055/auth/login', {
body: JSON.stringify({
email: body.email,
password: body.password
}),
} ) I don't know if Director requires a |
Can you try out https://github.com/sindresorhus/ky/releases/tag/v1.1.1 ? |
Pardon for the belated reply. The issue was related to node version that handled headers incorrectly. Upgrading node fixed it. Many thanks for support and time! |
I feel this issue resembles mine as well. I am using this library on To give more context, my setup includes |
Have you tried setting |
If it happens with native Since @intermundos has not replied, I'm going to close this for now. If anyone has a reproducible example that is broken with Ky but works with |
Hello all,
I am encountering an issue where HTTP POST requests are failing in Astro.js API route. The request is sent to Directus API.
The following request is failing with status 400 bad request.
Same request with Got or native fetch works as expected.
Many thanks in advance for your help.
The text was updated successfully, but these errors were encountered: