diff options
author | 2024-06-14 12:58:11 +0000 | |
---|---|---|
committer | 2024-06-14 12:58:11 +0000 | |
commit | ec94bb4a4ef0c3bdfcb197ed31bf0472015fb9ab (patch) | |
tree | 7f221aee850a7feddebea0b42ebf6c2bebe27f6d | |
parent | d996db6f0bf361ebd84b23d022db7bb10fb316e6 (diff) | |
download | astro-ec94bb4a4ef0c3bdfcb197ed31bf0472015fb9ab.tar.gz astro-ec94bb4a4ef0c3bdfcb197ed31bf0472015fb9ab.tar.zst astro-ec94bb4a4ef0c3bdfcb197ed31bf0472015fb9ab.zip |
[ci] format
-rw-r--r-- | packages/astro/src/core/errors/errors-data.ts | 10 | ||||
-rw-r--r-- | packages/astro/src/core/render-context.ts | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index 6d0692e7e..572b7874b 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -1266,18 +1266,17 @@ export const ServerOnlyModule = { message: (name: string) => `The "${name}" module is only available server-side.`, } satisfies ErrorData; - /** * @docs * @description * `Astro.rewrite()` cannot be used if the request body has already been read. If you need to read the body, first clone the request. For example: - * + * * ```js * const data = await Astro.request.clone().formData(); - * + * * Astro.rewrite("/target") * ``` - * + * * @see * - [Request.clone()](https://developer.mozilla.org/en-US/docs/Web/API/Request/clone) * - [Astro.rewrite](https://docs.astro.build/en/reference/configuration-reference/#experimentalrewriting) @@ -1286,7 +1285,8 @@ export const ServerOnlyModule = { export const RewriteWithBodyUsed = { name: 'RewriteWithBodyUsed', title: 'Cannot use Astro.rewrite after the request body has been read', - message: 'Astro.rewrite() cannot be used if the request body has already been read. If you need to read the body, first clone the request.', + message: + 'Astro.rewrite() cannot be used if the request body has already been read. If you need to read the body, first clone the request.', } satisfies ErrorData; /** diff --git a/packages/astro/src/core/render-context.ts b/packages/astro/src/core/render-context.ts index 6bafba1e7..cf9c4bf01 100644 --- a/packages/astro/src/core/render-context.ts +++ b/packages/astro/src/core/render-context.ts @@ -542,7 +542,7 @@ export class RenderContext { * @param oldRequest The old `Request` */ #copyRequest(newUrl: URL, oldRequest: Request): Request { - if(oldRequest.bodyUsed) { + if (oldRequest.bodyUsed) { throw new AstroError(AstroErrorData.RewriteWithBodyUsed); } return new Request(newUrl, { |