Skip to content

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rooosiu authored Oct 10, 2024
1 parent c06ce49 commit bffe4d0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ Route::middleware(LocalizationMiddleware::class)->get('/', [MyController::class,
```

### ForceJsonMiddleware
This middleware changes the `accept: *` header to `accept: application/json`.

Middleware that ensures all incoming HTTExceptionsHandler requests to your Laravel application expect a JSON response.

example of use in provider:
example:

```php
$this->getRouter()->prependMiddlewareToGroup('api', ForceJsonMiddleware::class);
$this->app['router']->prependMiddlewareToGroup('api', ForceJsonMiddleware::class);
// inside service provider

Route::middleware(ForceJsonMiddleware::class)->get('/', [MyController::class, 'index']);
// inside routes
```

---
Expand Down

0 comments on commit bffe4d0

Please sign in to comment.