Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Last active March 29, 2022 12:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kettanaito/afc09e1901c97349e7ccca31ed5ec63d to your computer and use it in GitHub Desktop.
Save kettanaito/afc09e1901c97349e7ccca31ed5ec63d to your computer and use it in GitHub Desktop.
Request issuing in NodeJS

This document describes a flow of a request issued by different modules/libraries in NodeJS environment.

window.fetch (jsdom)

node-fetch

@ChristopherA
Copy link

ChristopherA commented Mar 29, 2022

You can now do this directly in GitHub's markdown in your gists:

graph TD
  window.fetch --> XMLHttpRequest
  XMLHttpRequest --> request(request, 3rd party)
  request --> protocol{Protocol}
  protocol -- https --> https.request
  protocol -- http --> http.request

  https.request --> ClientRequest
  http.request --> ClientRequest
  ClientRequest --> IncomingMessage
graph TD
  nodeFetch[node-fetch] --> protocol{Protocol}
  protocol -- https --> https.request
  protocol -- http --> http.request
  https.request --> ClientRequest
  http.request --> ClientRequest
  ClientRequest --> IncomingMessage

@kettanaito
Copy link
Author

Nice, @ChristopherA! I didn't know that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment