Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting OutgoingMessage #36438

Closed
wants to merge 2 commits into from

Conversation

caleblallen
Copy link

@caleblallen caleblallen commented Dec 8, 2020

I took a crack at Documenting Outgoing Message per #33847

Repeated and cleaned up language from http.ServerResponse.

I cannot figure out how to get OutgoingMessage to send on its own, however. It feels like it is intended as an abstract class for http.ServerResponse?

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Dec 8, 2020
@caleblallen caleblallen closed this Dec 8, 2020
@kaizhu256
Copy link
Contributor

note http.OutgoingMessage is also inherited by http.ClientRequest. the example below illustrates its usage in both client and server.

let http = require("http");

// OutgoingMessage used in http-client
let outgoingMessage1 = http.request("http://www.example.com", console.log);
outgoingMessage1.end("upload some data");

// OutgoingMessage used in http-server
http.createServer(function (req, outgoingMessage2) {
    outgoingMessage2.statusCode = 404;
    outgoingMessage2.end("404 Not Found");
}).listen(8080);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants