Closed dominik-erni closed 2 months ago
Or can't you send this "is_storyblok_preview" as http request header from Storyblok Visual Editor, then you don0t need to call request.json()
in this live preview middleware and the problem should be gone
I tested it with changing the line in the live preview middleware dist to:
const requestBody = await request.clone().json();
Then our POST API calls work again
@dominik-erni Thank you for identifying the issue with the POST request URL and suggesting the solution of making a copy of the request.
I'm happy to inform you that we have added the fix and optimized the middleware further. The changes are currently under review and will be merged soon.
We appreciate your patience and will update you once the fix is released.
:tada: This issue has been resolved in version 4.1.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
It would be nice when the live preview middleware would clone the request before consuming it with request.json(). In our project we have a custom middleware which for general logging which tries to clone the request before consuming it to log the body to the console, but this now fails because the request has already been consumed.
Link
Expected Behavior
Consuming the request after this live preview middleware consumed it should not fail.
Current Behavior
Consuming the request after this live preview middleware consumed it fails currently.
Steps to Reproduce