You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now with fetch going mainstream as a browser api. Does it make sense to implement http.fetch method with the same interface to give isomorphic support?
I know there are modules, but doesn't this make sense being bundled as part of http api ?
Considering the simplicity that fetch brings, along prevalence of higher level http fetch mechanisms in other languages (e.g. php's file_get_contents), and, now, it's ubiquity, I wonder if fetch doesn't deserve to be baked in?
I guess now with async await, node core api's should really have a promise
version of the api's as well. Or atleast a core api to map callback apis to
promise api.
The callback design from the start I think wasn't a great architectural
decision.
+1 on fetch being baked in. It should be a core JS engine API. (Both DOM
and Node)
It's not the goal of core's http module that it have a high-level API like "other languages", its intended to be a low-level implementation of core HTTP protocol mechanisms, see https://www.npmjs.com/package/request and others for high level APIs. Its a strength of node's that due to node's use of npm, multiple HTTP APIs can co-exist, and that eventually when one is determined to not be the greatest anymore (perhaps it doesn't support Promises or work so well with async/await?), that in can be superceeded painlessly by a new, better API - which would not be possible if node core tried to balance being everything to everybody, including all new browser and language features as they are invented, and yet somehow also being backwards compatible forever.
If the browser's fetch API can't be implemented in as an npm module because of some lack in node core, that is something that should be addressed, but there isn't any sign of that yet.
Activity
mscdex commentedon Jun 27, 2016
IMHO this is best left to userland. There are a lot of browser APIs node does not implement.
cjihrig commentedon Jun 27, 2016
+1 to leaving this to userland.
nojvek commentedon Jun 27, 2016
no problem. Closing this.
mbrevda commentedon Aug 6, 2016
Considering the simplicity that
fetchbrings, along prevalence of higher level http fetch mechanisms in other languages (e.g. php'sfile_get_contents), and, now, it's ubiquity, I wonder iffetchdoesn't deserve to be baked in?jimmywarting commentedon Nov 13, 2016
I want it even more now when we got async & await!!! It goes hand in hand like bread and butter.
nojvek commentedon Nov 13, 2016
I guess now with async await, node core api's should really have a promise
version of the api's as well. Or atleast a core api to map callback apis to
promise api.
The callback design from the start I think wasn't a great architectural
decision.
+1 on fetch being baked in. It should be a core JS engine API. (Both DOM
and Node)
On Sun, Nov 13, 2016 at 11:51 AM, Jimmy Karl Roland Wärting <
notifications@github.com> wrote:
sam-github commentedon Nov 14, 2016
It's not the goal of core's
httpmodule that it have a high-level API like "other languages", its intended to be a low-level implementation of core HTTP protocol mechanisms, see https://www.npmjs.com/package/request and others for high level APIs. Its a strength of node's that due to node's use ofnpm, multiple HTTP APIs can co-exist, and that eventually when one is determined to not be the greatest anymore (perhaps it doesn't support Promises or work so well with async/await?), that in can be superceeded painlessly by a new, better API - which would not be possible if node core tried to balance being everything to everybody, including all new browser and language features as they are invented, and yet somehow also being backwards compatible forever.If the browser's fetch API can't be implemented in as an npm module because of some lack in node core, that is something that should be addressed, but there isn't any sign of that yet.