Skip to content

Commit

Permalink
fix: only disallow body with GET/HEAD requests (#11710)
Browse files Browse the repository at this point in the history
Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
Rich-Harris and Rich-Harris authored Jan 22, 2024
1 parent e0e12d8 commit f56781f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-insects-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: only disallow body with GET/HEAD
6 changes: 3 additions & 3 deletions packages/kit/src/exports/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export async function getRequest({ request, base, bodySizeLimit }) {
method: request.method,
headers: /** @type {Record<string, string>} */ (request.headers),
body:
request.method === 'POST' || request.method === 'PUT' || request.method === 'PATCH'
? get_raw_body(request, bodySizeLimit)
: undefined
request.method === 'GET' || request.method === 'HEAD'
? undefined
: get_raw_body(request, bodySizeLimit)
});
}

Expand Down

0 comments on commit f56781f

Please sign in to comment.