@@ -64,23 +64,22 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)
6464 try {
6565 $ request = $ stats ->getRequest ();
6666 $ response = $ stats ->getResponse ();
67- $ data = [
68- 'status ' => $ response ->getStatusCode (),
69- 'reason ' => $ response ->getReasonPhrase (),
70- 'headers ' => $ response ->getHeaders (),
71- 'body ' => $ this ->getResponsePayload ($ response ),
72- ];
73-
74- Telescope::recordClientRequest (IncomingEntry::make ([
67+ $ content = [
7568 'method ' => $ request ->getMethod (),
7669 'uri ' => $ request ->getUri ()->__toString (),
7770 'headers ' => $ request ->getHeaders (),
78- 'response_status ' => $ data ['status ' ],
79- 'response_headers ' => $ data ['headers ' ],
80- 'response_data ' => $ data ,
8171 'duration ' => $ stats ->getTransferTime () * 1000 ,
82- ]));
83- } catch (Throwable $ e ) {
72+ ];
73+
74+ if ($ response = $ stats ->getResponse ()) {
75+ $ content ['response_status ' ] = $ response ->getStatusCode ();
76+ $ content ['response_headers ' ] = $ response ->getHeaders ();
77+ $ content ['response_reason ' ] = $ response ->getReasonPhrase ();
78+ $ content ['response_payload ' ] = $ this ->getResponsePayload ($ response );
79+ }
80+
81+ Telescope::recordClientRequest (IncomingEntry::make ($ content ));
82+ } catch (Throwable $ exception ) {
8483 // We will catch the exception to prevent the request from being interrupted.
8584 }
8685
0 commit comments