chore: updated dependencies

This commit is contained in:
SethCohen
2023-09-23 12:37:35 -04:00
parent f228faeb5e
commit 24b80abb6f
25 changed files with 124 additions and 92 deletions
-4
View File
@@ -288,10 +288,6 @@ export const getNodeRequestOptions = request => {
agent = agent(parsedURL);
}
if (!headers.has('Connection') && !agent) {
headers.set('Connection', 'close');
}
// HTTP-network fetch step 4.2
// chunked encoding is handled by Node.js
+19
View File
@@ -124,6 +124,25 @@ export default class Response extends Body {
return response;
}
static json(data = undefined, init = {}) {
const body = JSON.stringify(data);
if (body === undefined) {
throw new TypeError('data is not JSON serializable');
}
const headers = new Headers(init && init.headers);
if (!headers.has('content-type')) {
headers.set('content-type', 'application/json');
}
return new Response(body, {
...init,
headers
});
}
get [Symbol.toStringTag]() {
return 'Response';
}