I'm building an small API with passport auth with laravel 8 and also using FormRequest classes for validations requests.
Problem is that when an error occurrs, API doesn't respond with JSON, it just returns nothing.
I've already created a new Middleware to handle only json responses by adding this $request->headers->set('Accept', 'application/json');
on the handle method, but it doesn't seem to be working!
Does anyone knows if I'm missing something?
https://stackoverflow.com/questions/67310401/forcing-json-responses-for-api-not-working-on-laravel-8 April 29, 2021 at 10:54AM
没有评论:
发表评论