Skip to content

Conversation

@clue
Copy link
Member

@clueclue commented Jul 7, 2020

This changeset adds an HTTP client implementation by importing clue/reactphp-buzz v2.9.0 and the underlying react/http-client v0.5.10. This client implementation uses a Promise-based API using common PSR-7 messages just like the existing server implementation, so they share common interfaces and concepts.

$browser = newReact\Http\Browser($loop); $browser->get($url)->then(function (Psr\Http\Message\ResponseInterface$response){echo$response->getBody()});

The code has been imported as-is, with only minor changes to the namespace from Clue\React\Buzz to React\Http and we otherwise leave all the existing APIs unchanged. Deprecated client APIs have been dropped for this major release. As such, this is a pure feature addition with no BC breaks. Upgrading from clue/reactphp-buzz 2.9.0 to the upcoming react/http v1.0.0 should be a matter of updating some namespace references only:

// old$browser = newClue\React\Buzz\Browser($loop); // new$browser = newReact\Http\Browser($loop);

By promoting my existing HTTP client implementation clue/reactphp-buzz, we can now provide better support for this component and take advantage of a shared code base. Among others, a follow-up will eliminate a number of minor code duplicates and improve code reuse for specific HTTP edge cases. Upcoming changes will focus on some exciting and long-awaited features, but more on that in follow-up PRs.

See https://github.com/clue/reactphp-buzz for original repo. I'm planning to soft-deprecate this repository in the future and will redirect users to this HTTP component instead.

Resolves#148

@clueclue added this to the v1.0.0 milestone Jul 7, 2020
clue added 4 commits July 7, 2020 19:05
Change namespace from `Clue\React\Buzz` to `React\Http` and update all tests with merged namespaces. See https://github.com/clue/reactphp-buzz for original repo.
Change namespace from `React\HttpClient` to `React\Http\Client` and mark all classes as internal only. See https://github.com/reactphp/http-client for original repo.
jsor
jsor approved these changes Jul 8, 2020
@WyriHaximusWyriHaximus merged commit 16ad5a9 into reactphp:masterJul 8, 2020
@clueclue deleted the http-client branch July 8, 2020 12:56
@legionth
Copy link
Contributor

Nice 👍

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge HttpClient component into this component

4 participants

@clue@legionth@jsor@WyriHaximus