Skip to content

Commit df050ae

Browse files
committed
Update close handler to avoid unhandled promise rejections
1 parent c275806 commit df050ae

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"php": ">=5.4",
1515
"evenement/evenement": "^3.0 || ^2.0",
1616
"react/event-loop": "^1.2",
17-
"react/http": "^1.6"
17+
"react/http": "^1.6",
18+
"react/promise": "^3 || ^2.10 || ^1.2.1"
1819
},
1920
"require-dev": {
2021
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.35"

src/EventSource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ public function close()
270270

271271
$request->then(function (ResponseInterface $response) {
272272
$response->getBody()->close();
273+
}, function () {
274+
// ignore to avoid reporting unhandled rejection
273275
});
274276
$request->cancel();
275277
}

0 commit comments

Comments
 (0)