Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP client implementation (import clue/reactphp-buzz v2.9.0) #368

Merged
merged 5 commits into from
Jul 8, 2020

Conversation

clue
Copy link
Member

@clue clue 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 = new React\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 = new Clue\React\Buzz\Browser($loop);

// new
$browser = new React\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

@clue clue 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.
@clue clue requested review from WyriHaximus and jsor July 7, 2020 20:16
@WyriHaximus WyriHaximus merged commit 16ad5a9 into reactphp:master Jul 8, 2020
@clue clue deleted the http-client branch July 8, 2020 12:56
@legionth
Copy link
Contributor

legionth commented Jul 9, 2020

Nice 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge HttpClient component into this component
4 participants