Skip to content

Add form handling and request body preservation in paraglideMiddleware#597

Open
samuelstroschein wants to merge 1 commit into
mainfrom
astro-564
Open

Add form handling and request body preservation in paraglideMiddleware#597
samuelstroschein wants to merge 1 commit into
mainfrom
astro-564

Conversation

@samuelstroschein

@samuelstroschein samuelstroschein commented Jan 16, 2026

Copy link
Copy Markdown
Member

Closes #564

  • Introduced a POST form in the Astro example to demonstrate form submission.
  • Updated paraglideMiddleware to clone requests with bodies to prevent errors.
  • Added a new API endpoint to handle POST requests and return submitted messages.

Note

Fixes request body consumption in paraglideMiddleware and adds a minimal POST demo in the Astro example.

  • In middleware.js, clone body-bearing requests (non-GET/HEAD) before rewrapping and use the cloned instance when constructing Request, preventing "Body has already been read" on POST/PUT/PATCH/DELETE
  • Astro example: add api/post.ts endpoint that echoes a message from form data, and add a POST form to index.astro to exercise the behavior
  • Add a changeset marking a patch release for @inlang/paraglide-js

Written by Cursor Bugbot for commit d96f611. This will update automatically on new commits. Configure here.

- Introduced a POST form in the Astro example to demonstrate form submission.
- Updated paraglideMiddleware to clone requests with bodies to prevent errors.
- Added a new API endpoint to handle POST requests and return submitted messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

astro integration: does not work for POST requests

1 participant