Skip to content

Commit 1e683d3

Browse files
author
danil zakablukovskii
committed
unsubscribe from the stream
1 parent 61bf248 commit 1e683d3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Request.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ public function handleData($data)
136136
list($response, $bodyChunk) = $this->parseResponse($this->buffer);
137137
} catch (\InvalidArgumentException $exception) {
138138
$this->emit('error', [$exception, $this]);
139-
140-
return;
141139
}
142140

143141
$this->buffer = null;
@@ -147,6 +145,10 @@ public function handleData($data)
147145
$this->stream->removeListener('end', array($this, 'handleEnd'));
148146
$this->stream->removeListener('error', array($this, 'handleError'));
149147

148+
if (!isset($response)) {
149+
return;
150+
}
151+
150152
$this->response = $response;
151153

152154
$response->on('end', function () {

0 commit comments

Comments
 (0)