File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. This projec
44to [ Semantic Versioning] (http://semver.org/ ). For change log format,
55use [ Keep a Changelog] (http://keepachangelog.com/ ).
66
7+ ## [ 1.3.1] - 2022-07-19
8+
9+ ### Fixed
10+
11+ - Try to decode content if empty
12+ - Trimmed content before inflate failed
13+
714## [ 1.3.0] - 2021-11-26
815
916### Added
Original file line number Diff line number Diff line change @@ -342,18 +342,21 @@ public function sendRequest(RequestInterface $request): ResponseInterface
342342 // Body
343343 $ stream = new Stream ();
344344 $ streamData = substr ($ content , curl_getinfo ($ ch , CURLINFO_HEADER_SIZE ));
345- if (isset ($ headers ['Content-Encoding ' ])) {
346- // Gzip
347- if (in_array ('gzip ' , $ headers ['Content-Encoding ' ])) {
348- $ streamData = gzdecode ($ streamData );
345+ if (!empty ($ streamData )) {
346+ if (isset ($ headers ['Content-Encoding ' ])) {
347+ // Gzip
348+ if (in_array ('gzip ' , $ headers ['Content-Encoding ' ])) {
349+ $ streamData = gzdecode ($ streamData );
350+ }
351+
352+ // Deflate
353+ if (in_array ('deflate ' , $ headers ['Content-Encoding ' ])) {
354+ $ streamData = gzinflate ($ streamData );
355+ }
349356 }
350357
351- // Deflate
352- if (in_array ('deflate ' , $ headers ['Content-Encoding ' ])) {
353- $ streamData = gzinflate (trim ($ streamData ));
354- }
358+ $ stream ->write ($ streamData );
355359 }
356- $ stream ->write ((string )$ streamData );
357360
358361 // Construct object
359362 $ response = new Response (
You can’t perform that action at this time.
0 commit comments