Skip to content

Commit

Permalink
lib: add fetch
Browse files Browse the repository at this point in the history
Fixes: #19393

PR-URL: #41749
Refs: nodejs/undici#1183
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
  • Loading branch information
targos committed Feb 1, 2022
1 parent 7123a00 commit 6ec2253
Show file tree
Hide file tree
Showing 16 changed files with 8,076 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Expand Up @@ -338,5 +338,9 @@ module.exports = {
atob: 'readable',
performance: 'readable',
structuredClone: 'readable',
fetch: 'readable',
Headers: 'readable',
Request: 'readable',
Response: 'readable',
},
};
25 changes: 25 additions & 0 deletions LICENSE
Expand Up @@ -634,6 +634,31 @@ The externally maintained libraries used by Node.js are:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

- undici, located at deps/undici, is licensed as follows:
"""
MIT License

Copyright (c) Matteo Collina and Undici contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

- OpenSSL, located at deps/openssl, is licensed as follows:
"""
Apache License
Expand Down
21 changes: 21 additions & 0 deletions deps/undici/LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Matteo Collina and Undici contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

28 comments on commit 6ec2253

@sea-witch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@dashdanw
Copy link

@dashdanw dashdanw commented on 6ec2253 Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wooOooOoOooo

@nataliescottdavidson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally!

@jashsayani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!! Finally! It was about time.

@manueltarouca
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this replace axios?

@euvl
Copy link

@euvl euvl commented on 6ec2253 Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this replace axios?

image

@simondebbarma
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah snap, here we go again
refactor time

@danilovaz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehehe axios

bye

@zeddotes
Copy link

@zeddotes zeddotes commented on 6ec2253 Feb 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehehe axios

bye

My thoughts exactly. I do wanna express how much I've enjoyed working with axios and hope it becomes a wrapper around fetch as opposed to obsolete because of it.

@eglove
Copy link

@eglove eglove commented on 6ec2253 Feb 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol axios. Nice to think things like cross-fetch won't be needed anymore though.

@mwalden2004
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So excited to see this come to Node. Can't wait for it to go live.

@bertolo1988
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @targos. Thank you.

@leonyu
Copy link

@leonyu leonyu commented on 6ec2253 Feb 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it handle cookies and XSS header?

@ckychris
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

History!

@jwandekoken
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done, guys.

@natiginfo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great news!

@Luna-devv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@archcorsair
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! About time 😎 Great news

@zadeviggers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray!

@lucasgonze
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The what WG includes CSP in this feature. I'm not seeing an implementation here. Is it there and I'm not seeing it, or is it contemplated?

@Abdizriel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally!

@eddwinpaz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long time for this feature to come out.

@loynoir
Copy link

@loynoir loynoir commented on 6ec2253 Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!!

@loynoir
Copy link

@loynoir loynoir commented on 6ec2253 Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, might I ask, where will the low level stuff goes?
Things like cookie, connection, proxy
createFetch(superUserOptions) or fetch(...,{_key: val})

@vishalims095
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js is making a HUGE change in the new version! 😮

@infi
Copy link

@infi infi commented on 6ec2253 Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome

@rilysh
Copy link

@rilysh rilysh commented on 6ec2253 Feb 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! At least now gotta relax from choosing different request libraries, feels like Deno implementation! Excellent! 👍 ❤

@Berns89
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be so sick!

Please sign in to comment.