mirror of
https://github.com/withastro/astro.git
synced 2025-02-03 22:29:08 -05:00
[ci] format
This commit is contained in:
parent
d996db6f0b
commit
ec94bb4a4e
2 changed files with 6 additions and 6 deletions
|
@ -1266,18 +1266,17 @@ export const ServerOnlyModule = {
|
||||||
message: (name: string) => `The "${name}" module is only available server-side.`,
|
message: (name: string) => `The "${name}" module is only available server-side.`,
|
||||||
} satisfies ErrorData;
|
} satisfies ErrorData;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
* @description
|
* @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:
|
* `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
|
* ```js
|
||||||
* const data = await Astro.request.clone().formData();
|
* const data = await Astro.request.clone().formData();
|
||||||
*
|
*
|
||||||
* Astro.rewrite("/target")
|
* Astro.rewrite("/target")
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @see
|
* @see
|
||||||
* - [Request.clone()](https://developer.mozilla.org/en-US/docs/Web/API/Request/clone)
|
* - [Request.clone()](https://developer.mozilla.org/en-US/docs/Web/API/Request/clone)
|
||||||
* - [Astro.rewrite](https://docs.astro.build/en/reference/configuration-reference/#experimentalrewriting)
|
* - [Astro.rewrite](https://docs.astro.build/en/reference/configuration-reference/#experimentalrewriting)
|
||||||
|
@ -1286,7 +1285,8 @@ export const ServerOnlyModule = {
|
||||||
export const RewriteWithBodyUsed = {
|
export const RewriteWithBodyUsed = {
|
||||||
name: 'RewriteWithBodyUsed',
|
name: 'RewriteWithBodyUsed',
|
||||||
title: 'Cannot use Astro.rewrite after the request body has been read',
|
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;
|
} satisfies ErrorData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -542,7 +542,7 @@ export class RenderContext {
|
||||||
* @param oldRequest The old `Request`
|
* @param oldRequest The old `Request`
|
||||||
*/
|
*/
|
||||||
#copyRequest(newUrl: URL, oldRequest: Request): Request {
|
#copyRequest(newUrl: URL, oldRequest: Request): Request {
|
||||||
if(oldRequest.bodyUsed) {
|
if (oldRequest.bodyUsed) {
|
||||||
throw new AstroError(AstroErrorData.RewriteWithBodyUsed);
|
throw new AstroError(AstroErrorData.RewriteWithBodyUsed);
|
||||||
}
|
}
|
||||||
return new Request(newUrl, {
|
return new Request(newUrl, {
|
||||||
|
|
Loading…
Add table
Reference in a new issue