- Add
HttpOptions::setHeader()
to add or replace a single header - Allow mocking
start_time
info inMockResponse
- Add
MockResponse::fromFile()
andJsonMockResponse::fromFile()
methods to help using fixtures files - Add
ThrottlingHttpClient
to enable limiting the number of requests within a certain period - Deprecate the
setLogger()
methods of theNoPrivateNetworkHttpClient
,TraceableHttpClient
andScopingHttpClient
classes, configure the logger of the wrapped clients directly instead
- Remove implementing
Http\Message\RequestFactory
fromHttplugClient
- Add
HarFileResponseFactory
testing utility, allow to replay responses from.har
files - Add
max_retries
option toRetryableHttpClient
to adjust the retry logic on a per request level - Add
PingWehookMessage
andPingWebhookMessageHandler
- Enable using EventSourceHttpClient::connect() for both GET and POST
- Add option
crypto_method
to set the minimum TLS version and make it default to v1.2 - Add
UriTemplateHttpClient
to use URI templates as specified in the RFC 6570 - Add
ServerSentEvent::getArrayData()
to get the Server-Sent Event's data decoded as an array when it's a JSON payload - Allow array of urls as
base_uri
option value inRetryableHttpClient
to retry on a new url each time - Add
JsonMockResponse
, aMockResponse
shortcut that automatically encodes the passed body to JSON and sets the content type toapplication/json
by default - Support file uploads by nesting resource streams in option "body"
- Make
HttplugClient
implementPsr\Http\Message\RequestFactoryInterface
,StreamFactoryInterface
andUriFactoryInterface
- Deprecate implementing
Http\Message\RequestFactory
,StreamFactory
andUriFactory
onHttplugClient
- Add
withOptions()
toHttplugClient
andPsr18Client
- Allow yielding
Exception
from MockResponse's$body
to mock transport errors - Remove credentials from requests redirected to same host but different port
- Add
MockHttpClient::setResponseFactory()
method to be able to set response factory after client creating
- Implement
HttpClientInterface::withOptions()
fromsymfony/contracts
v2.4 - Add
DecoratorTrait
to ease writing simple decorators
- added
AsyncDecoratorTrait
to ease processing responses without breaking async - added support for pausing responses with a new
pause_handler
callable exposed as an info item - added
StreamableInterface
to ease turning responses into PHP streams - added
MockResponse::getRequestMethod()
andgetRequestUrl()
to allow inspecting which request has been sent - added
EventSourceHttpClient
a Server-Sent events stream implementing the EventSource specification - added option "extra.curl" to allow setting additional curl options in
CurlHttpClient
- added
RetryableHttpClient
to automatically retry failed HTTP requests. - added
extra.trace_content
option toTraceableHttpClient
to prevent it from keeping the content in memory
- added
NoPrivateNetworkHttpClient
decorator - added
AmpHttpClient
, a portable HTTP/2 implementation based on Amp - added
LoggerAwareInterface
toScopingHttpClient
andTraceableHttpClient
- made
HttpClient::create()
return anAmpHttpClient
whenamphp/http-client
is found but curl is not or too old
- added
canceled
toResponseInterface::getInfo()
- added
HttpClient::createForBaseUri()
- added
HttplugClient
with support for sync and async requests - added
max_duration
option - added support for NTLM authentication
- added
StreamWrapper
to cast anyResponseInterface
instances to PHP streams. - added
$response->toStream()
to cast responses to regular PHP streams - made
Psr18Client
implement relevant PSR-17 factories and have streaming responses - added
TraceableHttpClient
,HttpClientDataCollector
andHttpClientPass
to integrate with the web profiler - allow enabling buffering conditionally with a Closure
- allow option "buffer" to be a stream resource
- allow arbitrary values for the "json" option
- added the component