Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
20 | public function handle(Request $request, Closure $next) |
||
21 | { |
||
22 | // Handle request |
||
23 | $method = $request->getMethod(); |
||
24 | |||
25 | // Support using HEAD method for checking If-None-Match |
||
26 | if ($request->isMethod('HEAD')) { |
||
27 | $request->setMethod('GET'); |
||
28 | } |
||
29 | |||
30 | // Handle response |
||
31 | $response = $next($request); |
||
32 | |||
33 | // Setting etag |
||
34 | $etag = EtagConditionals::getEtag($request, $response); |
||
35 | $response->setEtag($etag); |
||
36 | |||
37 | $request->setMethod($method); |
||
38 | |||
39 | return $response; |
||
40 | } |
||
42 |