@@ -48,7 +48,7 @@ public function requestObject(Payload $payload): Response
48
48
49
49
$ response = $ this ->sendRequest (fn (): \Psr \Http \Message \ResponseInterface => $ this ->client ->sendRequest ($ request ));
50
50
51
- $ contents = $ response ->getBody ()-> getContents ();
51
+ $ contents = ( string ) $ response ->getBody ();
52
52
53
53
if (str_contains ($ response ->getHeaderLine ('Content-Type ' ), ContentType::TEXT_PLAIN ->value )) {
54
54
return Response::from ($ contents , $ response ->getHeaders ());
@@ -75,7 +75,7 @@ public function requestContent(Payload $payload): string
75
75
76
76
$ response = $ this ->sendRequest (fn (): \Psr \Http \Message \ResponseInterface => $ this ->client ->sendRequest ($ request ));
77
77
78
- $ contents = $ response ->getBody ()-> getContents ();
78
+ $ contents = ( string ) $ response ->getBody ();
79
79
80
80
$ this ->throwIfJsonError ($ response , $ contents );
81
81
@@ -102,7 +102,7 @@ private function sendRequest(Closure $callable): ResponseInterface
102
102
return $ callable ();
103
103
} catch (ClientExceptionInterface $ clientException ) {
104
104
if ($ clientException instanceof ClientException) {
105
- $ this ->throwIfJsonError ($ clientException ->getResponse (), $ clientException ->getResponse ()->getBody ()-> getContents ());
105
+ $ this ->throwIfJsonError ($ clientException ->getResponse (), ( string ) $ clientException ->getResponse ()->getBody ());
106
106
}
107
107
108
108
throw new TransporterException ($ clientException );
@@ -122,7 +122,7 @@ private function throwIfJsonError(ResponseInterface $response, string|ResponseIn
122
122
$ statusCode = $ response ->getStatusCode ();
123
123
124
124
if ($ contents instanceof ResponseInterface) {
125
- $ contents = $ contents ->getBody ()-> getContents ();
125
+ $ contents = ( string ) $ contents ->getBody ();
126
126
}
127
127
128
128
try {
0 commit comments