-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
Live component force post requests #1218
Live component force post requests #1218
Conversation
Thanks for getting this rolling - that's awesome! Might it make sense to have the setting not as an attribute but on the |
I tried that first as this was your first suggestion. But I was not able to pass the property to the frontend yet. Would |
If we added a new |
Should we make that a default ? I agree with @hepisec, and i'm even ready to say that any data sent to the server should be in POST... |
I've added support for |
Is there something checking the request is sent in POST in the backend side ? I think somehow the LiveComponentSubscriber should be updated no ? |
I've added a check for |
After talking with a few people, I think we should reverse your PR. We should make components use POST by default, with an option to opt into GET. The reason is the one given in your description. And, more generally, if you think of a live component re-render as a type of "form submit" (and, if the user is changing a prop value... then they likely are filling out a form in one way or another), then form submits should almost always be POST (Symfony forms, for example, default to Could you change the option from |
I'll update the PR in the next days to have POST by default, as suggested by @weaverryan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your work @hepisec! 🧡
I've finished the work on this issue. As POST is now the new default method and GET is only allowed when Thanks everyone so far, I'm looking forward to your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor notes - this is looking good. Thanks for the patience on the slow review - but this is a very important PR!
Friendly ping to you @hepisec :). Let us know if you have time to do the final steps! Thanks! |
I'm starting right now. |
It should be done now. The failed tests seem to be related to TwigComponent and are 8.2 only. I wish you all happy holidays. |
Hey @hepisec! Sorry for the delay - this is ready to merge. Can you rebase this please? Thanks! |
Rebase done. Looking forward to my first finished contribution to symfony/ux :-) |
5bafb88
to
4310601
Compare
Thank you 1000 for this @hepisec! |
…r (daFish) This PR was merged into the 2.x branch. Discussion ---------- fix: use method from metadata for live component test helper | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT After #1218 has been released as part of 2.14.0 my tests fail. This change passes the actual method to the requests made by the test helper. Commits ------- d84f3eb fix: use method from metadata for live component test helper
When your component model may contain sensitive data, you probably don't want your data being transferred via GET requests, because then the data might leak to browser history, server logs etc.
With this PR you can add
forcePost: true
to#[AsLiveComponent]
and your component will always use POST requests to talk to the backend.