@@ -48,7 +48,7 @@ public function requestObject(Payload $payload): Response
4848
4949 $ response = $ this ->sendRequest (fn (): \Psr \Http \Message \ResponseInterface => $ this ->client ->sendRequest ($ request ));
5050
51- $ contents = $ response ->getBody ()-> getContents ();
51+ $ contents = ( string ) $ response ->getBody ();
5252
5353 if (str_contains ($ response ->getHeaderLine ('Content-Type ' ), ContentType::TEXT_PLAIN ->value )) {
5454 return Response::from ($ contents , $ response ->getHeaders ());
@@ -75,7 +75,7 @@ public function requestContent(Payload $payload): string
7575
7676 $ response = $ this ->sendRequest (fn (): \Psr \Http \Message \ResponseInterface => $ this ->client ->sendRequest ($ request ));
7777
78- $ contents = $ response ->getBody ()-> getContents ();
78+ $ contents = ( string ) $ response ->getBody ();
7979
8080 $ this ->throwIfJsonError ($ response , $ contents );
8181
@@ -102,7 +102,7 @@ private function sendRequest(Closure $callable): ResponseInterface
102102 return $ callable ();
103103 } catch (ClientExceptionInterface $ clientException ) {
104104 if ($ clientException instanceof ClientException) {
105- $ this ->throwIfJsonError ($ clientException ->getResponse (), $ clientException ->getResponse ()->getBody ()-> getContents ());
105+ $ this ->throwIfJsonError ($ clientException ->getResponse (), ( string ) $ clientException ->getResponse ()->getBody ());
106106 }
107107
108108 throw new TransporterException ($ clientException );
@@ -120,7 +120,7 @@ private function throwIfJsonError(ResponseInterface $response, string|ResponseIn
120120 }
121121
122122 if ($ contents instanceof ResponseInterface) {
123- $ contents = $ contents ->getBody ()-> getContents ();
123+ $ contents = ( string ) $ contents ->getBody ();
124124 }
125125
126126 try {
0 commit comments