@@ -12,7 +12,7 @@ user is able to stream data.
1212
1313HTTP message headers are represented by an object like this:
1414
15- ```
15+ ``` js
1616{ ' content-length' : ' 123' ,
1717 ' content-type' : ' text/plain' ,
1818 ' connection' : ' keep-alive' ,
@@ -34,7 +34,7 @@ property, which is an array of `[key, value, key2, value2, ...]`. For
3434example, the previous message header object might have a ` rawHeaders `
3535list like the following:
3636
37- ```
37+ ``` js
3838[ ' ConTent-Length' , ' 123456' ,
3939 ' content-LENGTH' , ' 123' ,
4040 ' content-type' , ' text/plain' ,
@@ -222,16 +222,16 @@ header is still mutable using the `setHeader(name, value)`, `getHeader(name)`,
222222` removeHeader(name) ` API. The actual header will be sent along with the first
223223data chunk or when closing the connection.
224224
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
228228argument which is an instance of [ ` http.IncomingMessage ` ] [ ] .
229229
230- During the ` 'response' ` event, one can add listeners to the
230+ During the [ ` 'response' ` ] [ ] event, one can add listeners to the
231231response object; particularly to listen for the ` 'data' ` event.
232232
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,
235235then you ** must** consume the data from the response object, either by
236236calling ` response.read() ` whenever there is a ` 'readable' ` event, or
237237by adding a ` 'data' ` handler, or by calling the ` .resume() ` method.
@@ -677,7 +677,7 @@ already been bound to a port or domain socket.
677677Listening on a file descriptor is not supported on Windows.
678678
679679This 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() ` ] [ ] .
681681
682682Returns ` server ` .
683683
@@ -689,7 +689,7 @@ added: v0.1.90
689689Start a UNIX socket server listening for connections on the given ` path ` .
690690
691691This 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) ` ] [ ] .
693693
694694### server.listen(port[ , hostname] [ , backlog ] [ , callback] )
695695<!-- YAML
@@ -709,7 +709,7 @@ The actual length will be determined by your OS through sysctl settings such as
709709parameter is 511 (not 512).
710710
711711This 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) ` ] [ ] .
713713
714714### server.listening
715715<!-- YAML
@@ -1084,7 +1084,7 @@ added: v0.1.17
10841084
10851085An ` IncomingMessage ` object is created by [ ` http.Server ` ] [ ] or
10861086[ ` 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,
10881088headers and data.
10891089
10901090It implements the [ Readable Stream] [ ] interface, as well as the
@@ -1264,22 +1264,22 @@ added: v0.1.90
12641264Request URL string. This contains only the URL that is
12651265present in the actual HTTP request. If the request is:
12661266
1267- ```
1267+ ``` txt
12681268GET /status?name=ryan HTTP/1.1\r\n
12691269Accept: text/plain\r\n
12701270\r\n
12711271```
12721272
12731273Then ` request.url ` will be:
12741274
1275- ```
1275+ ``` js
12761276' /status?name=ryan'
12771277```
12781278
12791279If you would like to parse the URL into its parts, you can use
12801280` require('url').parse(request.url) ` . Example:
12811281
1282- ```
1282+ ``` txt
12831283$ node
12841284> require('url').parse('/status?name=ryan')
12851285{
@@ -1294,7 +1294,7 @@ If you would like to extract the parameters from the query string,
12941294you can use the ` require('querystring').parse ` function, or pass
12951295` true ` as the second argument to ` require('url').parse ` . Example:
12961296
1297- ```
1297+ ``` txt
12981298$ node
12991299> require('url').parse('/status?name=ryan', true)
13001300{
@@ -1419,7 +1419,7 @@ Options:
14191419 function. See [ ` agent.createConnection() ` ] [ ] for more details.
14201420
14211421The optional ` callback ` parameter will be added as a one time listener for
1422- the ` 'response' ` event.
1422+ the [ ` 'response' ` ] [ ] event.
14231423
14241424` http.request() ` returns an instance of the [ ` http.ClientRequest ` ] [ ]
14251425class. 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.
15211521[ `socket.setKeepAlive()` ] : net.html#net_socket_setkeepalive_enable_initialdelay
15221522[ `socket.setNoDelay()` ] : net.html#net_socket_setnodelay_nodelay
15231523[ `socket.setTimeout()` ] : net.html#net_socket_settimeout_timeout_callback
1524- [ `stream.setEncoding()` ] : stream.html#stream_stream_setencoding_encoding
15251524[ `TypeError` ] : errors.html#errors_class_typeerror
15261525[ `url.parse()` ] : url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
15271526[ constructor options ] : #http_new_agent_options
0 commit comments