feat: catch any response

This commit is contained in:
tlanyan 2021-01-09 14:35:45 +08:00
parent 5959e80efb
commit 6be49c6742

View File

@ -131,6 +131,8 @@ function fetch(Psr\Http\Message\ServerRequestInterface $req) {
$url = substr($url, 1); $url = substr($url, 1);
$client = new React\Http\Browser($loop); $client = new React\Http\Browser($loop);
// catch any response
$client = $client->withRejectErrorResponse(false);
// see https://github.com/reactphp/http#streaming-response // see https://github.com/reactphp/http#streaming-response
return $client->requestStreaming($req->getMethod(), $url)->then(function (Psr\Http\Message\ResponseInterface $response) { return $client->requestStreaming($req->getMethod(), $url)->then(function (Psr\Http\Message\ResponseInterface $response) {