Laravel API: “Force“ to Return JSON (even without client headers)

One of the typical mistakes of API developers is forgetting to send the “Accept: application/json“ header. No worries, we can solve it from the Laravel side. - Original Tweet: - [Course] Re-creating API with Laravel and PHPUnit - Laravel: API Error Returns HTML and not JSON - How To Fix - - - - - Support the channel by checking out my products: - My Laravel courses: - Filament examples: - Laravel QuickAdminPanel: - Livewire Kit Components: - - - - - Other places to follow: - My weekly Laravel newsletter: - My personal Twitter:
Back to Top