-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
doc: fix some mistakes of http-api-doc #14625
Conversation
@@ -74,9 +74,9 @@ to keep the Node.js process running when there are no outstanding requests. | |||
It is good practice, to [`destroy()`][] an `Agent` instance when it is no | |||
longer in use, because unused sockets consume OS resources. | |||
|
|||
Sockets are removed from an agent's pool when the socket emits either | |||
Sockets are removed from an agent when the socket emits either |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agent's pool is agent.freeSockets
. When a socket is assigned to a request, the socket must not be in agent.freeSockets
.
@@ -590,11 +591,17 @@ Example: | |||
|
|||
```js | |||
const http = require('http'); | |||
const server = http.createServer((req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The req
in the code is not http.ClientRequest
.
Thank you. |
doc/api/http.md
Outdated
}; | ||
const req = http.get(options); | ||
req.end(); | ||
req.once('response', res => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint error:
599:22 error Expected parentheses around arrow function argument arrow-parens
doc/api/http.md
Outdated
socket reusability. | ||
connection can be reused. For an HTTP agent, this returns | ||
`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent, | ||
the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line exceeds 80 characters and needs to be rewrapped.
@@ -253,8 +255,7 @@ added: v0.3.6 | |||
* {number} | |||
|
|||
By default set to Infinity. Determines how many concurrent sockets the agent | |||
can have open per origin. Origin is either a 'host:port' or | |||
'host:port:localAddress' combination. | |||
can have open per origin. Origin is the returned value of [`agent.getName()`][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link needs a reference at the bottom of the doc.
@@ -285,7 +286,7 @@ This object is created internally and returned from [`http.request()`][]. It | |||
represents an _in-progress_ request whose header has already been queued. The | |||
header is still mutable using the `setHeader(name, value)`, `getHeader(name)`, | |||
`removeHeader(name)` API. The actual header will be sent along with the first | |||
data chunk or when closing the connection. | |||
data chunk or when calling [`request.end()`][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link needs a reference at the bottom of the doc.
cc @nodejs/http |
592f69b
to
2e05b30
Compare
@vsemozhetbyt what should I do if I want to know these errors in my machine before pushing a new commit. |
node tools\eslint\bin\eslint.js --rulesdir tools/eslint-rules/ --ext=.js,.md benchmark doc lib test tools Feel free to ask any more questions if I am unclear on something) |
@vsemozhetbyt How can I get the rendered version of the doc? |
@MoonBall You can click on the "View" button from the diff tab (I've marked it by the red line): |
Or, if you will want to check errors before creating a PR, you can view a doc from your new pushed branch in your fork: https://github.com/MoonBall/node/blob/modify-http-api-doc/doc/api/http.md |
2e05b30
to
ee11a57
Compare
@vsemozhetbyt Thank you. I have fixed these problems. |
@MoonBall Thank you! |
Linter CI: https://ci.nodejs.org/job/node-test-linter/10974/ (green). |
ee11a57
to
35fc4f2
Compare
@vsemozhetbyt The linter CI seems like disappering after I push a new commit by using |
@vsemozhetbyt I find a good way to get the rendered doc from Building Node.js. Just run |
This should work this way, it is OK. For the future: if you add some changes after a review, it is better to do this in an additional commit (it will be squashed later), so the reviewers should not re-review all the diff again. Could you enumerate the new changes in the amended commit? Linter CI: https://ci.nodejs.org/job/node-test-linter/11107/ (green). |
OK. I comment the new changed code in the commit. |
const ip = req.socket.remoteAddress; | ||
const port = req.socket.remotePort; | ||
const ip = res.socket.remoteAddress; | ||
const port = res.socket.remotePort; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasnell @vsemozhetbyt It's changed after you reviewed.
@@ -652,7 +659,7 @@ not be emitted. | |||
added: v5.5.0 | |||
--> | |||
|
|||
* `request` {http.ClientRequest} | |||
* `request` {http.IncomingMessage} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasnell @vsemozhetbyt It's changed after you reviewed.
@jasnell Do the last changes seem OK for you? Can we land? |
PR-URL: #14625 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Landed in 4d842e3 |
PR-URL: #14625 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
PR-URL: #14625 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
fix some mistakes of http-api-doc.
Checklist
Affected core subsystem(s)
doc, http