summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar matthewp <matthewp@users.noreply.github.com> 2023-08-28 15:59:37 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2023-08-28 15:59:37 +0000
commit57e9a28063c28e5ad81034ca170291aba6084100 (patch)
tree0d70ca49618232d4fde1ca32d0bd125a38978264
parent1048aca550769415e528016e42b358ffbfd44b61 (diff)
downloadastro-57e9a28063c28e5ad81034ca170291aba6084100.tar.gz
astro-57e9a28063c28e5ad81034ca170291aba6084100.tar.zst
astro-57e9a28063c28e5ad81034ca170291aba6084100.zip
[ci] format
-rw-r--r--packages/astro/src/core/endpoint/index.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts
index b8c7000fb..a3aff6dca 100644
--- a/packages/astro/src/core/endpoint/index.ts
+++ b/packages/astro/src/core/endpoint/index.ts
@@ -96,7 +96,11 @@ export let ResponseWithEncoding: ReturnType<typeof initResponseWithEncoding>;
// TODO Remove this after StackBlitz supports Node 18.
let initResponseWithEncoding = () => {
class LocalResponseWithEncoding extends Response {
- constructor(body: ResponseParameters[0], init: ResponseParameters[1], encoding?: BufferEncoding) {
+ constructor(
+ body: ResponseParameters[0],
+ init: ResponseParameters[1],
+ encoding?: BufferEncoding
+ ) {
// If a body string is given, try to encode it to preserve the behaviour as simple objects.
// We don't do the full handling as simple objects so users can control how headers are set instead.
if (typeof body === 'string') {
@@ -109,9 +113,9 @@ let initResponseWithEncoding = () => {
body = encoder.encode(body);
}
}
-
+
super(body, init);
-
+
if (encoding) {
this.headers.set('X-Astro-Encoding', encoding);
}
@@ -125,7 +129,7 @@ let initResponseWithEncoding = () => {
initResponseWithEncoding = (() => {}) as any;
return LocalResponseWithEncoding;
-}
+};
export async function callEndpoint<MiddlewareResult = Response | EndpointOutput>(
mod: EndpointHandler,