Open renhyl opened 1 month ago
It would be awesome to see this resolved sooner rather than later, for one it's fetch
, this affects SvelteKit, I specifically experienced this bug while using houdinigraphql in SvelteKit where houdinigraphql uses SvelteKit's server_fetch:
@sveltejs/kit/src/runtime/server/fetch.js
https://github.com/sveltejs/kit/blob/f67898d25ee32e9377221979d2a9e6b792786f4e/packages/kit/src/runtime/server/fetch.js#L20
Recently faced with the same error
export const apiRequest = async <T>(
fetch: typeof window.fetch,
url: string,
params: Record<string, FormDataEntryValue | null>
) => {
const response = await fetch(`${PUBLIC_SERVER_HOST_URL}${url}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(params)
});
return (await response.json()) as T;
};
Code above is sending GET request instead of POST with bun (sveltekit/houdini server fetch)
What version of Bun is running?
1.1.8
What platform is your computer?
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
Bun malforms request when using overload version of
fetch()
bun run --bun dev --port 5174
ref: https://developer.mozilla.org/en-US/docs/Web/API/fetch
when calling fetch('url', options) the request works as expected
calling same with
const response = await fetch(myRequest);
does not work.as compared to node behaviour, or bun without
--bun
flag, both variations should work the same.What is the expected behavior?
calling fetch in either variations should have same result
const response = await fetch('http://localhost:3000/graphql', myRequest);
should be same asconst response = await fetch(myRequest);
for a slong as myRequest contains url.What do you see instead?
No response
Additional information
No response