@@ -42,14 +42,14 @@ public static function getContents(MessageInterface $message):string{
4242 * @throws \JsonException
4343 */
4444 public static function decodeJSON (MessageInterface $ message , bool |null $ assoc = null ):mixed {
45- return json_decode (self ::getContents ($ message ), ($ assoc ?? false ), 512 , JSON_THROW_ON_ERROR );
45+ return json_decode (self ::decompress ($ message ), ($ assoc ?? false ), 512 , JSON_THROW_ON_ERROR );
4646 }
4747
4848 /**
4949 * @return \SimpleXMLElement|\stdClass|mixed
5050 */
5151 public static function decodeXML (MessageInterface $ message , bool |null $ assoc = null ):mixed {
52- $ data = simplexml_load_string (self ::getContents ($ message ));
52+ $ data = simplexml_load_string (self ::decompress ($ message ));
5353
5454 return $ assoc === true
5555 ? json_decode (json_encode ($ data ), true ) // cruel
@@ -91,7 +91,7 @@ public static function toString(MessageInterface $message, bool|null $appendBody
9191
9292 // appending the body might cause issues in some cases, e.g. with large responses or file streams
9393 if ($ appendBody === true ){
94- $ msg .= sprintf ("\r\n\r\n%s " , self ::getContents ($ message ));
94+ $ msg .= sprintf ("\r\n\r\n%s " , self ::decompress ($ message ));
9595 }
9696
9797 return $ msg ;
@@ -133,7 +133,7 @@ public static function toJSON(MessageInterface $message, bool|null $appendBody =
133133 }
134134
135135 if ($ appendBody === true ){
136- $ msg ['body ' ] = self ::getContents ($ message );
136+ $ msg ['body ' ] = self ::decompress ($ message );
137137 }
138138
139139 return json_encode ($ msg , (JSON_THROW_ON_ERROR |JSON_PRETTY_PRINT |JSON_UNESCAPED_SLASHES ));
0 commit comments