Return 422 status code when the form fails#488
Merged
lchrusciel merged 3 commits intoOct 18, 2022
Conversation
This also brings support for Symfony UX Turbo
78d37aa to
2f3dfc2
Compare
lchrusciel
approved these changes
Oct 18, 2022
|
|
||
| return $this->redirectHandler->redirectToResource($configuration, $newResource); | ||
| } | ||
| if ($request->isMethod('POST') && $form->isSubmitted() && !$form->isValid()) { |
Contributor
There was a problem hiding this comment.
Small improvement - we could add a blank line before if and extract the content of the check to the separate method
Suggested change
| if ($request->isMethod('POST') && $form->isSubmitted() && !$form->isValid()) { | |
| if ($this->isFormInValid($request, $form)) { |
| 'science_book[author][lastName]' => $newBookAuthorLastName, | ||
| ]); | ||
|
|
||
| $this->assertResponseCode($this->client->getResponse(), Response::HTTP_UNPROCESSABLE_ENTITY); |
Contributor
There was a problem hiding this comment.
I'm not sure if it is not bc-break and if we didn't send a 400 error. But looking at the code and related PR, I assume we didn't, so I'm fine with this change
Zales0123
added a commit
that referenced
this pull request
Oct 18, 2022
- [#341](#341) Dropping usage of Request->get ([@loic425](https://github.com/loic425), [@Zales0123](https://github.com/Zales0123)) - [#450](#450) Adjust when some runtime deprecation notices are triggered and use Symfony's trigger_deprecation() helper ([@mbabker](https://github.com/mbabker)) - [#467](#467) [README] Add development section and update links ([@lchrusciel](https://github.com/lchrusciel)) - [#478](#478) Add tests with grids ([@loic425](https://github.com/loic425)) - [#487](#487) Make CsrfTokenManager public ([@Zales0123](https://github.com/Zales0123)) - [#488](#488) Return 422 status code when the form fails ([@belmeopmenieuwesim](https://github.com/belmeopmenieuwesim), [@Zales0123](https://github.com/Zales0123))
lchrusciel
added a commit
to Sylius/Sylius
that referenced
this pull request
Oct 19, 2022
…les0123) This PR was merged into the 1.12 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Related tickets | | | License | MIT | [This change](Sylius/SyliusResourceBundle#488) resulted in a different response code which we checks in our Behats. It\'s a hot-fix, as we should change it in the SyliusResourceBundle itself 💃 But I would like to unblock builds Commits ------- 5eca8c6 [Hot-fix] Do not fail scenario after 422 response page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've taken over the #469 PR, added some tests and clean up the code. Thank you, @belmeopmenieuwesim, for the contribution 🖖