Giter VIP home page Giter VIP logo

Comments (7)

clue avatar clue commented on May 20, 2024 1

Minor progress update: #70 has been implemented, which means that one can now use ReactPHP's normal stream primitives to buffer the whole request body:

$request = $client->request('GET', 'https://google.com/');
$request->on('response', function (Response $response) {
    \React\Promise\Stream\buffer($response)->then(function ($body) {
        echo $body;
    }, 'printf');
});
$request->end();

We're still working on a simpler API for #41 👍

from http-client.

WyriHaximus avatar WyriHaximus commented on May 20, 2024

While try I like to keep streaming without storing data posssible, maybe #29 is a way to achieve this? Now the question is which one do we want to be the default. I personally think that easy access to the response body should be the default, and streaming it in should be a secondary option

from http-client.

clue avatar clue commented on May 20, 2024

This likely depends on #70 in order to fix stream semantics first.

We may then provide normal stream buffering routines and should probably add an example here.

Once this is in, we may want to look into #41 to implement PSR-7 message body support.

from http-client.

slince avatar slince commented on May 20, 2024

@clue It seems the function \React\Promise\Stream\buffer is not exists. .

from http-client.

jsor avatar jsor commented on May 20, 2024

@slince This function is from the react/promise-stream package.

composer req react/promise-stream

from http-client.

slince avatar slince commented on May 20, 2024

@jsor thks

from http-client.

clue avatar clue commented on May 20, 2024

I'm closing this as it is already supported by the new HTTP client that has been merged into react/http via reactphp/http#368 :shipit: You should upgrade as per #152 👍

from http-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.