Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ http.post('http://localhost/post?param1=value1&param2=value2', function (err

// explicit POST request, saves the response body to file

// for Buffer reqBody, the content-lenght header is reqBody.lenght
// for Buffer reqBody, the content-length header is reqBody.length
var reqBody = {
param1: 'value1',
param2: 'value2'
Expand Down Expand Up @@ -363,7 +363,7 @@ http.put({

// pipe a HTTP response (a http.IncomingMessage Object) to a PUT request
// http-request knows how to handle an IncomingMessage
// content-lenght is taken from the response if exists
// content-length is taken from the response if exists
require('http').get('http://example.org/file.ext', function (im) {
http.put({
url: 'http://localhost/put',
Expand All @@ -388,7 +388,7 @@ http.put({
url: 'http://localhost/put',
reqBody: readableStream,
headers: {
'content-lenght': 1337,
'content-length': 1337,
'content-type': 'text/plain'
}
}, 'put.bin', function (err, res) {
Expand Down
2 changes: 1 addition & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ module.exports = Request;
* @property {Boolean} noSslValidation Optional; turns of the SSL validation. **Warning:** do this only if you know what you're doing and if you have proper reasons for doing it. Making SSL useless is not a small thing to do
* @property {Boolean} stream Optional; passes a ReadableStream back to the completion callback of a HTTP request
* @property {Boolean} noRedirect Optional; turns off the HTTP redirects. Passes back the headers and body of the redirect response. Adds a couple of response headers which indicate the redirection target: redirect-to-url - which indicates the target URL for the redirect as the location header might be a relative path, and redirect-to-host if there's a specified host header in the request
* @property {Buffer|Stream} reqBody Optional; the contents of the request body for PUT, POST, etc. requests. Must be a Buffer or a Readable Stream instance. For Buffers, the content-length is Buffer.lenght. For a Readable Stream you must pass a content-length header, unless you're building a POST request with the [form-data](https://github.com/felixge/node-form-data) module. The library makes no assumptions about the content-type header, unless you're building a form with form-data
* @property {Buffer|Stream} reqBody Optional; the contents of the request body for PUT, POST, etc. requests. Must be a Buffer or a Readable Stream instance. For Buffers, the content-length is Buffer.length. For a Readable Stream you must pass a content-length header, unless you're building a POST request with the [form-data](https://github.com/felixge/node-form-data) module. The library makes no assumptions about the content-type header, unless you're building a form with form-data
* @property {Object} auth Optional; an Object that contains the authentication information. Currently it only implements HTTP Basic Authentication. The HTTP Basic Authentication was already supported by passing the username:password to the URL itself. This option provides a more API-friendly approach and it adds the basics for implementing HTTP Digest Authentication.
* @property {String} auth.type The authentication type; Supported value: basic
* @property {String} auth.username The HTTP Authentication username
Expand Down
2 changes: 1 addition & 1 deletion test/get.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ describe('HTTP GET method tests', function() {
assert.isNull(err, 'we have an error');

assert.strictEqual(res.code, 206, 'we have the proper status code');
assert.isDefined(res.headers['content-length'], 'we have a Content-Lenght');
assert.isDefined(res.headers['content-length'], 'we have a Content-Length');
assert.strictEqual(res.headers['content-range'], '0-5/11', 'we have the proper value for the Content-Range response header');
assert.strictEqual(res.headers['x-http-method'], 'GET', 'the method is GET');

Expand Down