-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(router): properly parse json response in the FormAction #1605
fix(router): properly parse json response in the FormAction #1605
Conversation
✅ Deploy Preview for analog-ng-app ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for analog-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thanks @milosdanilov, the fix looks good. We already have a Would you revert the changes to the cart and update that one instead? |
@brandonroberts Sure, will do |
4c703fb
to
a2c2f60
Compare
a2c2f60
to
b5ee12b
Compare
b5ee12b
to
62f94fc
Compare
Thanks! @allcontributors add @milosdanilov for code |
PR Checklist
Fixes the parsing of a JSON response created using the form server actions, used by the FormAction directive.
The problem arose because the
json
function, on the server, sets the Content-Type header toapplication/json; charset=utf-8
(see this line). The additionalcharset=utf-8
parameter caused the content-type check to fail, treating the response as plain text. As a result, the response was incorrectly parsed as text instead of JSON.What is the new behavior?
This change ensures the response is correctly handled as JSON, even when the
charset=utf-8
parameter is present in the Content-Type header.Does this PR introduce a breaking change?
Other information
The newsletter.page example in the analog-app is updated to show the email from the response, and additional cypress tests for newsletter page for this case are written.