File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,11 @@ import type { RequestEvent } from '@sveltejs/kit';
2
2
3
3
const getBody = async ( event : RequestEvent ) => {
4
4
const { request } = event ;
5
- return request . headers . get ( 'content-type' ) === 'application/json' ? request . json ( ) : request . text ( ) ;
5
+ if ( request . body ) {
6
+ return request . headers . get ( 'content-type' ) === 'application/json' ? request . json ( ) : request . text ( ) ;
7
+ } else {
8
+ return null ;
9
+ }
6
10
} ;
7
11
8
12
export { getBody } ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export function startServerAndCreateSvelteKitHandler<Context extends BaseContext
34
34
const httpGraphQLResponse = await server . executeHTTPGraphQLRequest ( {
35
35
context : ( ) => contextFunction ( event ) ,
36
36
httpGraphQLRequest : {
37
- body : await getBody ( event ) ,
37
+ body : await getBody ( event ) ?? '' ,
38
38
headers : getHeaders ( event ) ,
39
39
method : request . method ,
40
40
search : new URL ( request . url ) . search || '' ,
You can’t perform that action at this time.
0 commit comments