Namespace node.http
To use the HTTP server and client one must require('http')
.
The HTTP interfaces in Node are designed to support many features
of the protocol which have been traditionally difficult to use.
In particular, large, possibly chunk-encoded, messages. The interface is
careful to never buffer entire requests or responses--the
user is able to stream data.
HTTP message headers are represented by an object like this:
{ 'content-length': '123', 'content-type': 'text/plain', 'connection': 'keep-alive', 'accept': '*/*' }Keys are lowercased. Values are not modified. In order to support the full spectrum of possible HTTP applications, Node's HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.
- Defined in: node.http.js
Field Attributes | Field Name and Description |
---|---|
static |
node.http.parsers
|
static |
node.http.STATUS_CODES
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
static |
node.http.cat(url, encoding_, headers_)
|
static |
node.http.createClient(port, host)
|
static |
node.http.createServer(requestListener)
|
static |
node.http.get(options, cb)
|
static |
node.http.getAgent(host, port)
|
static |
node.http.request(options, cb)
|
Field Detail
static
node.http.parsers
static
node.http.STATUS_CODES
Method Detail
-
static node.http.cat(url, encoding_, headers_)
- Parameters:
- {string} url
- {string} encoding_
- {string} headers_
-
static node.http.createClient(port, host)
- Parameters:
- {string} port
- {string} host
-
- Parameters:
- {function(node.http.ClientRequest|node.http.ServerResponse):undefined} requestListener
- Returns:
- {node.http.Server}
-
static node.http.get(options, cb)
- Parameters:
- {Object} options
- {function(Error?|...[*]):undefined=} cb
-
static node.http.getAgent(host, port)
- Parameters:
- {string} host
- {string} port
-
static node.http.request(options, cb)
- Parameters:
- {Object} options
- {function(Error?|...[*]):undefined=} cb