@@ -42,14 +42,14 @@ public static function getContents(MessageInterface $message):string{
42
42
* @throws \JsonException
43
43
*/
44
44
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 );
46
46
}
47
47
48
48
/**
49
49
* @return \SimpleXMLElement|\stdClass|mixed
50
50
*/
51
51
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 ));
53
53
54
54
return $ assoc === true
55
55
? json_decode (json_encode ($ data ), true ) // cruel
@@ -91,7 +91,7 @@ public static function toString(MessageInterface $message, bool|null $appendBody
91
91
92
92
// appending the body might cause issues in some cases, e.g. with large responses or file streams
93
93
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 ));
95
95
}
96
96
97
97
return $ msg ;
@@ -133,7 +133,7 @@ public static function toJSON(MessageInterface $message, bool|null $appendBody =
133
133
}
134
134
135
135
if ($ appendBody === true ){
136
- $ msg ['body ' ] = self ::getContents ($ message );
136
+ $ msg ['body ' ] = self ::decompress ($ message );
137
137
}
138
138
139
139
return json_encode ($ msg , (JSON_THROW_ON_ERROR |JSON_PRETTY_PRINT |JSON_UNESCAPED_SLASHES ));
0 commit comments