Skip to content

Commit

Permalink
fix: only disallow body with GET/HEAD requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 22, 2024
1 parent d570557 commit 5ce04da
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 5ce04da

Please sign in to comment.