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
+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';
}