Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <[email protected]>
  • Loading branch information
ascorbic and sarah11918 authored Jun 14, 2024
1 parent 44ce527 commit 2e7605f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .changeset/healthy-oranges-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'astro': patch
---

Throws an error if Astro.rewrite is used after the request body has been used
Adds a new error `RewriteWithBodyUsed` that throws when `Astro.rewrite` is used after the request body has already been read.
4 changes: 2 additions & 2 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ export const ServerOnlyModule = {
/**
* @docs
* @description
* `Astro.rewrite()` cannot be used if the request body has already been read. If you need to read the body you should 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
* const data = await Astro.request.clone().formData();
Expand All @@ -1286,7 +1286,7 @@ 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 you should 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

0 comments on commit 2e7605f

Please sign in to comment.