@@ -103,10 +103,10 @@ public function make(CLIRequest|IncomingRequest $request, ResponseInterface $res
103103 return $ this ->cache ->save (
104104 $ this ->generateCacheKey ($ request ),
105105 serialize ([
106- 'headers ' => $ headers ,
107- 'output ' => $ response ->getBody (),
108- 'statuscode ' => $ response ->getStatusCode (),
109- 'reasonphrase ' => $ response ->getReasonPhrase (),
106+ 'headers ' => $ headers ,
107+ 'output ' => $ response ->getBody (),
108+ 'status ' => $ response ->getStatusCode (),
109+ 'reason ' => $ response ->getReasonPhrase (),
110110 ]),
111111 $ this ->ttl ,
112112 );
@@ -132,6 +132,8 @@ public function get(CLIRequest|IncomingRequest $request, ResponseInterface $resp
132132
133133 $ headers = $ cachedResponse ['headers ' ];
134134 $ output = $ cachedResponse ['output ' ];
135+ $ status = $ cachedResponse ['status ' ] ?? 200 ;
136+ $ reason = $ cachedResponse ['reason ' ] ?? '' ;
135137
136138 // Clear all default headers
137139 foreach (array_keys ($ response ->headers ()) as $ key ) {
@@ -145,9 +147,7 @@ public function get(CLIRequest|IncomingRequest $request, ResponseInterface $resp
145147
146148 $ response ->setBody ($ output );
147149
148- if (isset ($ cachedResponse ['statuscode ' ])) {
149- $ response ->setStatusCode ($ cachedResponse ['statuscode ' ], $ cachedResponse ['reasonphrase ' ] ?? '' );
150- }
150+ $ response ->setStatusCode ($ status , $ reason );
151151
152152 return $ response ;
153153 }
0 commit comments