|
@@ -1,4 +1,4 @@ discard block |
|
|
block discarded – undo |
|
1
|
|
-<?php declare(strict_types=1); |
|
|
1
|
+<?php declare(strict_types = 1); |
|
2
|
2
|
|
|
3
|
3
|
namespace WyriHaximus\React\Http\Middleware; |
|
4
|
4
|
|
|
@@ -46,14 +46,14 @@ discard block |
|
|
block discarded – undo |
|
46
|
46
|
|
|
47
|
47
|
$key = $uri; |
|
48
|
48
|
|
|
49
|
|
- return $this->cache->get($key)->then(function ($json) { |
|
|
49
|
+ return $this->cache->get($key)->then(function($json) { |
|
50
|
50
|
$cachedResponse = json_decode($json); |
|
51
|
51
|
|
|
52
|
52
|
return new Response($cachedResponse->code, [], stream_for($cachedResponse->body)); |
|
53
|
|
- }, function () use ($next, $request, $key) { |
|
54
|
|
- return resolve($next($request))->then(function (ResponseInterface $response) use ($key) { |
|
|
53
|
+ }, function() use ($next, $request, $key) { |
|
|
54
|
+ return resolve($next($request))->then(function(ResponseInterface $response) use ($key) { |
|
55
|
55
|
if (!($response->getBody() instanceof HttpBodyStream)) { |
|
56
|
|
- $body = (string)$response->getBody(); |
|
|
56
|
+ $body = (string) $response->getBody(); |
|
57
|
57
|
$cachedResponse = json_encode([ |
|
58
|
58
|
'body' => $body, |
|
59
|
59
|
'code' => $response->getStatusCode(), |
Please login to merge, or discard this patch.