| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 21 | public function handle(Request $request, Closure $next) |
||
| 22 | { |
||
| 23 | |||
| 24 | if ($request->header('Content-Type') !== self::JSONAPI_CONTENT_TYPE) { |
||
| 25 | return response(null, Response::HTTP_UNSUPPORTED_MEDIA_TYPE); |
||
| 26 | } |
||
| 27 | |||
| 28 | $accept = $request->header('accept', '*/*'); |
||
| 29 | |||
| 30 | if (!in_array($accept, ['*/*', self::JSONAPI_CONTENT_TYPE])) { |
||
| 31 | return response(null, Response::HTTP_NOT_ACCEPTABLE); |
||
| 32 | } |
||
| 33 | |||
| 34 | $response = $next($request); |
||
| 35 | |||
| 36 | $response->header('Content-Type', self::JSONAPI_CONTENT_TYPE); |
||
| 37 | |||
| 38 | return $response; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |