From 9187999f80720b9494692d2167d75144acb2ad05 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Mon, 1 Dec 2014 21:01:22 -0800 Subject: [PATCH] Fixing stream handler errors and tagging release --- CHANGELOG.md | 7 +++++++ src/Client/StreamHandler.php | 4 ++-- tests/Client/StreamHandlerTest.php | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3ce79..4133d1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## 1.0.4 - 2014-12-01 + +* Added support for older versions of cURL that do not have CURLOPT_TIMEOUT_MS. +* Setting debug to `false` does not enable debug output. +* Added a fix to the StreamHandler to return a `FutureArrayInterface` when an + error occurs. + ## 1.0.3 - 2014-11-03 * Setting the `header` stream option as a string to be compatible with GAE. diff --git a/src/Client/StreamHandler.php b/src/Client/StreamHandler.php index 7357e00..56e391d 100644 --- a/src/Client/StreamHandler.php +++ b/src/Client/StreamHandler.php @@ -131,13 +131,13 @@ private function createErrorResponse($url, RingException $e) $e = new ConnectException($e->getMessage(), 0, $e); } - return [ + return new CompletedFutureArray([ 'status' => null, 'body' => null, 'headers' => [], 'effective_url' => $url, 'error' => $e - ]; + ]); } /** diff --git a/tests/Client/StreamHandlerTest.php b/tests/Client/StreamHandlerTest.php index 8f63e29..7549a83 100644 --- a/tests/Client/StreamHandlerTest.php +++ b/tests/Client/StreamHandlerTest.php @@ -41,7 +41,10 @@ public function testAddsErrorToResponse() 'headers' => ['host' => ['localhost:123']], 'client' => ['timeout' => 0.01], ]); - + $this->assertInstanceOf( + 'GuzzleHttp\Ring\Future\CompletedFutureArray', + $result + ); $this->assertNull($result['status']); $this->assertNull($result['body']); $this->assertEquals([], $result['headers']);