Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3beaf2e

Browse files
authored
Better handle timeout (#809)
1 parent 16860e6 commit 3beaf2e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Core/src/Response.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,16 @@ public function resolve(?float $timeout = null): bool
105105
}
106106

107107
try {
108-
foreach ($this->httpClient->stream($this->httpResponse, $timeout) as $chunk) {
109-
if ($chunk->isTimeout()) {
110-
return false;
111-
}
112-
if ($chunk->isFirst()) {
113-
break;
108+
if (null === $timeout) {
109+
$this->httpResponse->getStatusCode();
110+
} else {
111+
foreach ($this->httpClient->stream($this->httpResponse, $timeout) as $chunk) {
112+
if ($chunk->isTimeout()) {
113+
return false;
114+
}
115+
if ($chunk->isFirst()) {
116+
break;
117+
}
114118
}
115119
}
116120

0 commit comments

Comments
 (0)