Skip to content

4.0.0 RC2

Pre-release
Pre-release

Choose a tag to compare

@trowski trowski released this 20 Aug 21:20
4391301

This release adds support for HTTP/2 push promises.

Note: This is a pre-release, there might be breaking changes in the final stable version.

Request now has an onPush() method which defines a callback invoked if the server pushes resources to the client. The callback should accept three arguments: Request $request, Promise $promise, and CancellationTokenSource $source. $request is the request as generated by the pushing server; $promise is a promise that is resolved with the Response object containing the pushed resource; and $source allows the push to be cancelled by the callback.

Request::getPushCallable() returns the callback defined with onPush().

If no push callback is defined in a request, the client automatically refuses any pushed resources.

Application and Network Interceptors should check for a push callback and apply transformations to the request and response accordingly.

Other changes or bugfixes

  • Fixed writing HTTP/2 request bodies
  • Fixed failed requests over HTTP/2 leaving promise returned from Client::request() unresolved
  • Using pseudo headers (headers field names starting with a colon (:)) in a Request or Response object is now forbidden