Yurunsoft / Guzzle-Swoole

让基于 Guzzle 的项目完美无缝兼容 Swoole 协程,支持:Guzzle、Elasticsearch client——来自宇润 PHP 全家桶
MIT License
161 stars 21 forks source link

Status code must be an integer value between 1xx and 5xx. #12

Closed zhenyuzhang-dadi01 closed 4 years ago

zhenyuzhang-dadi01 commented 4 years ago

代码如下: `DefaultHandler::setDefaultHandler(SwooleHandler::class); $client = new Client(); try{ $response = $client->request('GET', 'https://baidu.com', [ // 'verify' => false, 'expect' => false, 'timeout' => 30 ]); $aa = $response->getBody()->getContents(); }catch (RequestException $e){

    }`

当这样配置options时报错,报错信息如下: Status code must be an integer value between 1xx and 5xx. {"userId":1,"exception":"[object] (InvalidArgumentException(code: 0): Status code must be an integer value between 1xx and 5xx. at /var/www/html/hk01-bbt-webapi/vendor/guzzlehttp/psr7/src/Response.php:151)"}

Yurunsoft commented 4 years ago

已更新 v2.0.1 版本,这个问题可以通过捕获GuzzleHttp\Exception\ConnectException异常即可处理连接问题。