Commit

eec0aea

TIL: an Inertia request is not "JSON" for Laravel, even though it gets JSON back. $request->expectsJson() needs either Accept: */* on an XHR, or application/json. Inertia sends Accept: text/html, application/xhtml+xml, so it's false. Which means a middleware with if ($request->expectsJson()) return 403 JSON; else flash + back() already does the right thing for both fetch calls and Inertia forms. No X-Inertia check needed. Found this while a review bot suggested adding one to my PR. Checked the headers in the browser, and the bot agreed and withdrew it 🐰

commit eec0aea