Skip to content

Commit

Permalink
Revert "tweak"
Browse files Browse the repository at this point in the history
This reverts commit c1585b6.
  • Loading branch information
KATT committed Apr 30, 2024
1 parent c1585b6 commit 699d7d0
Showing 1 changed file with 3 additions and 8 deletions.
Expand Up @@ -52,7 +52,7 @@ function incomingMessageToBodyStream(
return stream;
}

const bodyMethods = new Set(['POST', 'PUT', 'PATCH']);
const bodyMethods = ['POST', 'PUT', 'PATCH'];
/**
* Convert an [`IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
*/
Expand All @@ -79,15 +79,10 @@ export function incomingMessageToRequest(
duplex: 'half',
};

if (req.method && bodyMethods.has(req.method)) {
if (req.method && bodyMethods.includes(req.method)) {
if (!('body' in req)) {
init.body = incomingMessageToBodyStream(req, opts);
} else if (
typeof req.body === 'string' ||
req.body instanceof Uint8Array ||
req.body instanceof Buffer ||
req.body instanceof ReadableStream
) {
} else if (typeof req.body === 'string') {
init.body = req.body;
} else if (req.body !== undefined) {
init.body = JSON.stringify(req.body);
Expand Down

0 comments on commit 699d7d0

Please sign in to comment.