| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Not sure if adding properties on core classes should be semver-major? |
Sorry, something went wrong.
|
Will work on test if there is positive feedback on this approach. |
Sorry, something went wrong.
|
@nodejs/streams |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/2735/ just to be safe |
Sorry, something went wrong.
Sorry, something went wrong.
|
Readable.body seems to be used in eco system. See CITGM (https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/nodes=rhel7-s390x/2735/testReport/). Any ideas on how to get around this?
@lpinca @jasnell @mcollina @dnlup https://github.com/visionmedia/superagent/blob/master/src/node/response.js#L36 |
Sorry, something went wrong.
|
The express stuff can be workaround through, but the superagent issue is maybe more difficult... https://github.com/visionmedia/superagent/blob/master/src/node/response.js#L36 |
Sorry, something went wrong.
There was a problem hiding this comment.
I don't think this is doable without massive ecosystem breakage. We need also to consider Duplex inherit from Readable, and therefore it will inherit a .json() method. However express provides a res.json() method, which will quickly get confused with this.
I think we are better off with a separate class, or some other utility Readable.toFetchBody(readable).json() or readable.toFetchBody().json().
Sorry, something went wrong.
That kind of kills the use case for me. Can we put it behind a flag passed to the constructor which is disabled by default? |
Sorry, something went wrong.
This means that most Node.js core object would not have those. I'm not sure that's what you would like achieve either. |
Sorry, something went wrong.
We wanted to support body mixin in undici request API without causing breaking change. Also it makes sense there in general. |
Sorry, something went wrong.
|
Taking another look at this I believe this can actually live outside of core (at least for my intended use case). nodejs/undici#907 |
Sorry, something went wrong.
|
Given the issue described in #39543, can we at least keep bodyUsed (under some other name if necessary)? Also possibly this[kReading] under some public API (maybe can be merged into readableDidRead)? |
Sorry, something went wrong.
|
I'm closing this. It's not possible to do it this way due ecosystem conflicts. If someone wants to pick it up in some other form feel free to branch off this or create an issue for discussion. I'm moving over to extending Readable in user land where needed. nodejs/undici#907 |
Sorry, something went wrong.
|
If I may give my feedback on this. I am sad that this is closed partially due to an outdated framework/library (express) that is already not working with modern JavaScript (AsyncFunction are causing memory leaks and crashes). There are no reason not to add this feature inside the core, especially if it is part of a major release (meaning their will be breaking changes). Libraries and frameworks need to adapt. It is not the role of Node.js to be adjusted. Everyone knows that patching/modifying core/native objects is a very bad practice. We should not rely on people who are doing that to keep us from improving Node.js core. |
Sorry, something went wrong.
I see (and appreciate) the sentiment but that's not the sort of burden of responsibility Node.js has. Express is used by millions of projects and we can't just break it. What about a mixinBody or similar method that enriches Readable (or a constructor option that opts into this)? |
Sorry, something went wrong.
I'm good with either. |
Sorry, something went wrong.
|
@benjamingr something like 1b7f509? |
Sorry, something went wrong.
|
Then different kinds of streams can opt-into this by default (so http IncomingRequest stream won't be able to by default but http.get might etc) |
Sorry, something went wrong.
This will make the API even harder to learn/use for folks. |
Sorry, something went wrong.
|
What do you suggest instead? |
Sorry, something went wrong.
|
Could there just be a module of stream consumers? import { asJson } from 'stream-readers';
const data = await asJson(stream);I might be missing some context around this PR. |
Sorry, something went wrong.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Make Readable expose the fetch boxy mixin API.
Bypasses webstream glue when possible.
This also makes conversion to webstream faster when the stream is not consumed through Readable by bypassing much of the Readable logic.
Refs: https://fetch.spec.whatwg.org/#body-mixin