request / request

🏊🏾 Simplified HTTP request client.
Apache License 2.0
25.69k stars 3.14k forks source link

Request's Architecture #1094

Closed seanstrom closed 5 years ago

seanstrom commented 9 years ago

Hey can some one give me a high level breakdown of request's architecture? I basically want to get some point of views of how this software is perceived and how it actually works. @mikeal

Freyert commented 8 years ago

Yeah doing a total rewrite would be a pain, and refactoring also a pain. As it stands now, the ideas I'm throwing out are probably better off for user land (Which you also see with express). Rewriting basic redirect logic is a fairly simple task and it's pretty easy to do what I'm talking about on your own.

It makes me curious though about what the original intent of this project was? What problem is it solving? If I like breaking off different pieces of logic like I am, should I just call it quits and start using the plain old http module or am I getting something from request? (Not to be contentious, I really do love the work that's been put into request, but I'm just curious to know if I'm not using it to it's full potential.)

simov commented 8 years ago

Yep, the API you are proposing should be implemented as a request wrapper. Good example is Purest which only configures request through its API, it doesn't handle anything HTTP specific directly.

As for request, its purpose is to implement some of the common features that you expect an HTTP client to have. The core HTTP module mainly parses the raw HTTP messages and handles the TCP sockets for you, through its Agent class. Well that's probably overly simplified but it's definitely not a full featured HTTP client, like a browser for example.

Some of the features currently in core were first implemented in request, like the forever-agent, also at that time there were no Streams2 and common Duplex stream interface.

Here is what I'm currently outlining as requirements for my own experiment:

I think that's it for now. Oh and btw the redirect logic with all of the request features is not the easiest thing to implement.

simov commented 8 years ago

https://github.com/request/request/issues/1982

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.