Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic authored and astrobot-houston committed Jun 14, 2024
1 parent d996db6 commit ec94bb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit ec94bb4

Please sign in to comment.