Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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