Skip to content

Commit b79852d

Browse files
author
Andrey Helldar
authored
Merge pull request #13 from TheDragonCode/2.x
Update `README.md`
2 parents 4843e50 + ec7b51d commit b79852d

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,8 @@ Or manually update `require` block of `composer.json` and run `composer update`.
3737

3838
After you've installed the package via composer, you're done. There's no step two.
3939

40-
This package will automatically register the `DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware` middleware in the `web` and `api` groups, if they
41-
exist. The middleware will add a header `Accept` that will effectively convert all responses to JSON format. This header will apply to all responses.
42-
43-
## Troubleshooting
44-
45-
> Why are my error messages not being converted to JSON?
46-
47-
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.
48-
49-
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.
40+
This package will automatically register the `DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware` middleware in the `web` and `api` groups, if they exist. The
41+
middleware will add a header `Accept` that will effectively convert all responses to JSON format. This header will apply to all responses.
5042

5143

5244
[badge_build]: https://img.shields.io/github/workflow/status/TheDragonCode/laravel-json-response/phpunit?style=flat-square

0 commit comments

Comments
 (0)