Skip to content

Commit

Permalink
Fixing for non-proxy case.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Dec 4, 2010
1 parent 45d41df commit 85e3d97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function request (options, callback) {
if (options.uri.auth && !options.headers.authorization) {
options.headers.authorization = "Basic " + toBase64(options.uri.auth);
}
if (options.proxy.auth && !options.headers['proxy-authorization']) {
if (options.proxy && options.proxy.auth && !options.headers['proxy-authorization']) {
options.headers['proxy-authorization'] = "Basic " + toBase64(options.proxy.auth);
}

Expand Down
1 change: 1 addition & 0 deletions tests/couch.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ request({uri:'http://mikeal.couchone.com/testjs', method:'POST', headers: h, bod

var options = {uri:'http://gmail.com'};
request(options, function (error, response, body) {
if (error) throw error;
assert.equal(response.statusCode, 200);
assert.equal(options.uri.host, 'www.google.com');
assert.equal(response.socket.port, 443);
Expand Down

0 comments on commit 85e3d97

Please sign in to comment.