Skip to content

Commit af34142

Browse files
authored
fix: ignore bodies sent with non-PUT/PATCH/POST requests (#11708)
* fix: ignore bodies sent with non-PUT/PATCH/POST requests * use || --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>
1 parent 5137c8c commit af34142

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/smooth-kids-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: ignore bodies sent with non-PUT/PATCH/POST requests

packages/kit/src/exports/node/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ export async function getRequest({ request, base, bodySizeLimit }) {
109109
duplex: 'half',
110110
method: request.method,
111111
headers: /** @type {Record<string, string>} */ (request.headers),
112-
body: get_raw_body(request, bodySizeLimit)
112+
body:
113+
request.method === 'POST' || request.method === 'PUT' || request.method === 'PATCH'
114+
? get_raw_body(request, bodySizeLimit)
115+
: undefined
113116
});
114117
}
115118

0 commit comments

Comments
 (0)