Make automatic redirect opt-in instead of opt-out #410
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.
This PR makes the automatic redirect back from an empty response opt-in instead of the current opt-out.
The reasoning behind this: I just created a fresh Inertia install and started building with TDD. After writing a test I ran it and immediately I was confused, one of the very first failures was an unexpected status code. Instead of a 200 I received a 302. I searched for quite some time, thought it might've been an incorrect middleware or something else really funky going on. Looked through Inertia's release notes and didn't see anything obvious that could cause it (I later noticed the releases on the website aren't maintained). After digging for a while I noticed #350 introduced a redirect back when an empty response is returned. Enabling this by default is extremely confusing imo, since a default Laravel app will never do this, but instead it creates an empty 200 response.