-
Notifications
You must be signed in to change notification settings - Fork 135
POST request with x-www-form-urlencoded is failing as Bad Request #466
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
Comments
try finishing off URLSearchParams with .toString() body: new URLSearchParams({
name: 'abc',
}).toString() |
I have the same issue. But it looks like that this is an issue with bun, not with ofetch => oven-sh/bun#18805 |
Confirmed that bun added Another related issue #439 shows that bun also added So we might have to handle it on our side. |
Environment
bun: 1.1.38
node: 18.17.0
ofetch: 1.4.1
Reproduction
I have a simple api that accepts a name and return a json response.
Steps:
go run app.go
It should error out.
Describe the bug
Form encoded post requests are not working as expected and erroring out(400).
Additional context
I tried using simple fetch and things were working as expected.
Even curl was working:
curl --request POST http://localhost:8080/hello --header 'Content-Type: application/x-www-form-urlencoded' --data name=abc
Logs
FetchError: [POST] "http://localhost:8080/hello": 400 Bad Request
The text was updated successfully, but these errors were encountered: