webclient / ext-protocol-version
PSR-18 HTTP客户端自动更改协议版本扩展
v2.0.0
2022-07-22 14:38 UTC
Requires
- php: ^7.4 || ^8.0
- psr/http-client: ^1.0
Requires (Dev)
- nyholm/psr7: ^1.5
- phpunit/phpunit: ^6.5 || ^7.5 || ^8.5 || ^9.5
- squizlabs/php_codesniffer: ^3.7
- webclient/fake-http-client: ^2.0
Suggests
- psr/http-client-implementation: Choice your favorite psr-18 implementation
Provides
This package is auto-updated.
Last update: 2024-08-22 19:19:57 UTC
README
webclient/ext-protocol-version
为PSR-18 HTTP客户端自动更改协议版本扩展。
安装
安装此包和您喜欢的 psr-18实现。
composer require webclient/ext-protocol-version:^2.0
使用
<?php use Webclient\Extension\ProtocolVersion\ProtocolClientDecorator; use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; /** * @var ClientInterface $client Your PSR-18 HTTP Client */ $http = new ProtocolClientDecorator($client); /** @var RequestInterface $request */ $response = $http->sendRequest($request);
如果服务器返回505错误,此客户端将使用服务器响应中指定的协议版本重复请求。