Giter Club home page Giter Club logo

Comments (6)

stephenplusplus avatar stephenplusplus commented on August 16, 2024

What went wrong with the first attempt?

from teeny-request.

callmehiphop avatar callmehiphop commented on August 16, 2024

@stephenplusplus we always piped the response body into the user stream, but I think we want to do it conditionally based on whether or not the user is actually trying to read from it.

from teeny-request.

stephenplusplus avatar stephenplusplus commented on August 16, 2024

It seems fair to assume if the user wants stream mode (signaled by not providing a callback), they want to read from it. Am I not considering something?

from teeny-request.

callmehiphop avatar callmehiphop commented on August 16, 2024

I think in its current state, it is not possible to read from yet we use it as a stream in places successfully. To me this implies that if we pipe unnecessarily we might be creating a (slow) memory leak?

from teeny-request.

stephenplusplus avatar stephenplusplus commented on August 16, 2024

AFAIK, our libs use teeny-request through retry-request (configured in common). retry-request gets the stream from the response event: https://github.com/stephenplusplus/retry-request/blob/6f69c95dceada6b4255c148fbd27c4d530fcec3e/index.js#L146.

But, I see the issue you're pointing out now. In the request library, they always piped a decorated stream back, but emitted the raw http.IncomingMessage response stream if the user needed it. So technically to be compatible as a straight conversion from request, we'd need to follow the same pattern, but I think we've come to care less about being 1:1 with request.

In any case, I think I have a solution in mind. I'll PR it up.

from teeny-request.

stephenplusplus avatar stephenplusplus commented on August 16, 2024

PR sent over here: #74

from teeny-request.

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.