Skip to content
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

[4.x] Check if form request wantsJson #9533

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Feb 16, 2024

I noticed that we arent checking if a form request wantsJson() in the failure message the way the success message is.

This means using JS fetch() on the front end gets a redirect rather than JSON when you throw a validation exception in a FormSubmitted listener.

This PR fixes that to return the JSON response.

@jasonvarga jasonvarga merged commit e0d10d5 into statamic:4.x Feb 20, 2024
18 checks passed
@ryanmitchell ryanmitchell deleted the fix/bug-in-json-response-from-form-request branch February 20, 2024 17:39
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.

3 participants