Skip to content

Commit

Permalink
fix: ignore bodies sent with non-PUT/PATCH/POST requests (#11708)
Browse files Browse the repository at this point in the history
* fix: ignore bodies sent with non-PUT/PATCH/POST requests

* use ||

---------

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
Rich-Harris and Rich-Harris authored Jan 22, 2024
1 parent 5137c8c commit af34142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smooth-kids-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: ignore bodies sent with non-PUT/PATCH/POST requests
5 changes: 4 additions & 1 deletion packages/kit/src/exports/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ export async function getRequest({ request, base, bodySizeLimit }) {
duplex: 'half',
method: request.method,
headers: /** @type {Record<string, string>} */ (request.headers),
body: get_raw_body(request, bodySizeLimit)
body:
request.method === 'POST' || request.method === 'PUT' || request.method === 'PATCH'
? get_raw_body(request, bodySizeLimit)
: undefined
});
}

Expand Down

0 comments on commit af34142

Please sign in to comment.