Skip to content

Commit f56781f

Browse files
authored
fix: only disallow body with GET/HEAD requests (#11710)
Co-authored-by: Rich Harris <[email protected]>
1 parent e0e12d8 commit f56781f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/four-insects-play.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: only disallow body with GET/HEAD

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ export async function getRequest({ request, base, bodySizeLimit }) {
110110
method: request.method,
111111
headers: /** @type {Record<string, string>} */ (request.headers),
112112
body:
113-
request.method === 'POST' || request.method === 'PUT' || request.method === 'PATCH'
114-
? get_raw_body(request, bodySizeLimit)
115-
: undefined
113+
request.method === 'GET' || request.method === 'HEAD'
114+
? undefined
115+
: get_raw_body(request, bodySizeLimit)
116116
});
117117
}
118118

0 commit comments

Comments
 (0)