From ec7b51d9d54d60d14995508e02989927306d6cfd Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 12 Feb 2022 01:20:26 +0300 Subject: [PATCH] Update `README.md` --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b6dec62..b95cb83 100644 --- a/README.md +++ b/README.md @@ -37,16 +37,8 @@ Or manually update `require` block of `composer.json` and run `composer update`. After you've installed the package via composer, you're done. There's no step two. -This package will automatically register the `DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware` middleware in the `web` and `api` groups, if they -exist. The middleware will add a header `Accept` that will effectively convert all responses to JSON format. This header will apply to all responses. - -## Troubleshooting - -> Why are my error messages not being converted to JSON? - -This is a feature of the [Laravel architecture](https://github.com/laravel/framework/blob/9.x/src/Illuminate/Foundation/Http/Kernel.php#L108-L116). The package makes corrections during the loading of the framework and it stores its state internally, and in case of an error, it takes the value of the request from the outside. Therefore, the error text is returned in html format. - -To fix this problem, you need to explicitly pass the `Accept: application/json` header in requests, or use the [`dragon-code/api-response`](https://github.com/TheDragonCode/api-response#best-practice-use-with-the-laravel-and-lumen-frameworks) package. +This package will automatically register the `DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware` middleware in the `web` and `api` groups, if they exist. The +middleware will add a header `Accept` that will effectively convert all responses to JSON format. This header will apply to all responses. [badge_build]: https://img.shields.io/github/workflow/status/TheDragonCode/laravel-json-response/phpunit?style=flat-square