-
-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Labels
BugSomething isn't working like it shouldSomething isn't working like it should
Description
When using the new .fetch i get the error Request with GET/HEAD method cannot have body.
(sveltekit version 1.0.0-next.359)
src/routes/index.svelte
export const load: Load = async function (event) {
// works
await event.fetch('/test', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
hello: 'World'
})
});
// breaks
await GQL_Artworks.fetch({ event });
return {};
};My houdini client looks like this
async function fetchQuery({ fetch, text = '', variables = {}, session }: RequestHandlerArgs) {
const headers: HeadersInit = {
'Content-Type': 'application/json',
apikey: import.meta.env.VITE_PUBLIC_KEY
};
if (session?.accessToken) {
headers['Authorization'] = `Bearer ${session.accessToken}`;
}
const result = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({
query: text,
variables
})
});
return await result.json();
}Metadata
Metadata
Assignees
Labels
BugSomething isn't working like it shouldSomething isn't working like it should