-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)feat: routingRelated to Astro routing (scope)Related to Astro routing (scope)help wantedPlease help with this issue!Please help with this issue!
Description
Astro Info
Astro v5.7.13
Node v20.19.1
System Linux (x64)
Package Manager npm
Output server
Adapter @astrojs/node
Integrations none
Describe the Bug
In my middleware there might be some intentional rewrites. But I ran into some unexpected behavior where I got the error:
Astro.rewrite() cannot be used if the request body has already been read. If you need to read the body, first clone the request.
I created a minimal reproducible example on Stackblitz.
- Check out the
src/middleware.tsfile. - Then open the preview and submit the form.
- The error will show.
I don't understand why though. The error mentions "If you need to read the body, first clone the request", but I am doing that. Why/where is Astro.rewrite() called anyway?
Am I misunderstanding this, or could this be a bug?
Perhaps someone could enlighten me? 😇
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-8mju777p?file=src%2Fmiddleware.ts
Metadata
Metadata
Assignees
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)feat: routingRelated to Astro routing (scope)Related to Astro routing (scope)help wantedPlease help with this issue!Please help with this issue!
