@@ -12,7 +12,7 @@ user is able to stream data.
12
12
13
13
HTTP message headers are represented by an object like this:
14
14
15
- ```
15
+ ``` js
16
16
{ ' content-length' : ' 123' ,
17
17
' content-type' : ' text/plain' ,
18
18
' connection' : ' keep-alive' ,
@@ -34,7 +34,7 @@ property, which is an array of `[key, value, key2, value2, ...]`. For
34
34
example, the previous message header object might have a ` rawHeaders `
35
35
list like the following:
36
36
37
- ```
37
+ ``` js
38
38
[ ' ConTent-Length' , ' 123456' ,
39
39
' content-LENGTH' , ' 123' ,
40
40
' content-type' , ' text/plain' ,
@@ -222,16 +222,16 @@ header is still mutable using the `setHeader(name, value)`, `getHeader(name)`,
222
222
` removeHeader(name) ` API. The actual header will be sent along with the first
223
223
data chunk or when closing the connection.
224
224
225
- To get the response, add a listener for ` 'response' ` to the request object.
226
- ` 'response' ` will be emitted from the request object when the response
227
- headers have been received. The ` 'response' ` event is executed with one
225
+ To get the response, add a listener for [ ` 'response' ` ] [ ] to the request object.
226
+ [ ` 'response' ` ] [ ] will be emitted from the request object when the response
227
+ headers have been received. The [ ` 'response' ` ] [ ] event is executed with one
228
228
argument which is an instance of [ ` http.IncomingMessage ` ] [ ] .
229
229
230
- During the ` 'response' ` event, one can add listeners to the
230
+ During the [ ` 'response' ` ] [ ] event, one can add listeners to the
231
231
response object; particularly to listen for the ` 'data' ` event.
232
232
233
- If no ` 'response' ` handler is added, then the response will be
234
- entirely discarded. However, if you add a ` 'response' ` event handler,
233
+ If no [ ` 'response' ` ] [ ] handler is added, then the response will be
234
+ entirely discarded. However, if you add a [ ` 'response' ` ] [ ] event handler,
235
235
then you ** must** consume the data from the response object, either by
236
236
calling ` response.read() ` whenever there is a ` 'readable' ` event, or
237
237
by adding a ` 'data' ` handler, or by calling the ` .resume() ` method.
@@ -677,7 +677,7 @@ already been bound to a port or domain socket.
677
677
Listening on a file descriptor is not supported on Windows.
678
678
679
679
This function is asynchronous. ` callback ` will be added as a listener for the
680
- ` 'listening' ` event. See also [ ` net.Server.listen() ` ] [ ] .
680
+ [ ` 'listening' ` ] [ ] event. See also [ ` net.Server.listen() ` ] [ ] .
681
681
682
682
Returns ` server ` .
683
683
@@ -689,7 +689,7 @@ added: v0.1.90
689
689
Start a UNIX socket server listening for connections on the given ` path ` .
690
690
691
691
This function is asynchronous. ` callback ` will be added as a listener for the
692
- ` 'listening' ` event. See also [ ` net.Server.listen(path) ` ] [ ] .
692
+ [ ` 'listening' ` ] [ ] event. See also [ ` net.Server.listen(path) ` ] [ ] .
693
693
694
694
### server.listen(port[ , hostname] [ , backlog ] [ , callback] )
695
695
<!-- YAML
@@ -709,7 +709,7 @@ The actual length will be determined by your OS through sysctl settings such as
709
709
parameter is 511 (not 512).
710
710
711
711
This function is asynchronous. ` callback ` will be added as a listener for the
712
- ` 'listening' ` event. See also [ ` net.Server.listen(port) ` ] [ ] .
712
+ [ ` 'listening' ` ] [ ] event. See also [ ` net.Server.listen(port) ` ] [ ] .
713
713
714
714
### server.listening
715
715
<!-- YAML
@@ -1084,7 +1084,7 @@ added: v0.1.17
1084
1084
1085
1085
An ` IncomingMessage ` object is created by [ ` http.Server ` ] [ ] or
1086
1086
[ ` http.ClientRequest ` ] [ ] and passed as the first argument to the ` 'request' `
1087
- and ` 'response' ` event respectively. It may be used to access response status,
1087
+ and [ ` 'response' ` ] [ ] event respectively. It may be used to access response status,
1088
1088
headers and data.
1089
1089
1090
1090
It implements the [ Readable Stream] [ ] interface, as well as the
@@ -1264,22 +1264,22 @@ added: v0.1.90
1264
1264
Request URL string. This contains only the URL that is
1265
1265
present in the actual HTTP request. If the request is:
1266
1266
1267
- ```
1267
+ ``` txt
1268
1268
GET /status?name=ryan HTTP/1.1\r\n
1269
1269
Accept: text/plain\r\n
1270
1270
\r\n
1271
1271
```
1272
1272
1273
1273
Then ` request.url ` will be:
1274
1274
1275
- ```
1275
+ ``` js
1276
1276
' /status?name=ryan'
1277
1277
```
1278
1278
1279
1279
If you would like to parse the URL into its parts, you can use
1280
1280
` require('url').parse(request.url) ` . Example:
1281
1281
1282
- ```
1282
+ ``` txt
1283
1283
$ node
1284
1284
> require('url').parse('/status?name=ryan')
1285
1285
{
@@ -1294,7 +1294,7 @@ If you would like to extract the parameters from the query string,
1294
1294
you can use the ` require('querystring').parse ` function, or pass
1295
1295
` true ` as the second argument to ` require('url').parse ` . Example:
1296
1296
1297
- ```
1297
+ ``` txt
1298
1298
$ node
1299
1299
> require('url').parse('/status?name=ryan', true)
1300
1300
{
@@ -1419,7 +1419,7 @@ Options:
1419
1419
function. See [ ` agent.createConnection() ` ] [ ] for more details.
1420
1420
1421
1421
The optional ` callback ` parameter will be added as a one time listener for
1422
- the ` 'response' ` event.
1422
+ the [ ` 'response' ` ] [ ] event.
1423
1423
1424
1424
` http.request() ` returns an instance of the [ ` http.ClientRequest ` ] [ ]
1425
1425
class. The ` ClientRequest ` instance is a writable stream. If one needs to
@@ -1521,7 +1521,6 @@ There are a few special headers that should be noted.
1521
1521
[ `socket.setKeepAlive()` ] : net.html#net_socket_setkeepalive_enable_initialdelay
1522
1522
[ `socket.setNoDelay()` ] : net.html#net_socket_setnodelay_nodelay
1523
1523
[ `socket.setTimeout()` ] : net.html#net_socket_settimeout_timeout_callback
1524
- [ `stream.setEncoding()` ] : stream.html#stream_stream_setencoding_encoding
1525
1524
[ `TypeError` ] : errors.html#errors_class_typeerror
1526
1525
[ `url.parse()` ] : url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
1527
1526
[ constructor options ] : #http_new_agent_options
0 commit comments