This middleware adds the ability to automatically add the Accept application/json header to every request if it was not provided.
Via composer:
composer require softonic/laravel-request-accept-json-middleware To use the middleware register it in app/Http/Kernel.php
protected $middleware = [ ... RequestAcceptJson::class, ... ]; From now on the header Accept: application/json will be automatically added to every request.
softonic/laravel-request-accept-json-middleware has a PHPUnit test suite and a coding style compliance test suite using PHP CS Fixer.
To run the tests, run the following command from the project folder.
$ docker-compose run testThe Apache 2.0 license. Please see LICENSE for more information.