Skip to content

Semantic meaning of response (res) and request (req) in Endpoint handlers #1605

Answered by uNetworkingAB
MacroMelon asked this question in Q&A
Discussion options

You must be logged in to vote

I can understand the confusion - HttpResponse should not have .onData because it's not part of the response, it's part of the request. All other JS servers put their equivalent of .onData in the request.

We can't do this because the lifetime of HttpRequest is way shorter than that of HttpResponse. So better naming would be:

HttpRequest becomes HttpHead and HttpResponse becomes HttpConnection

Then you have a naming that goes like head, connection rather than req, res.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@MacroMelon
Comment options

@uNetworkingAB
Comment options

Comment options

You must be logged in to vote
1 reply
@MacroMelon
Comment options

Answer selected by MacroMelon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants