Skip to content

Commit

Permalink
Added support for downloading the file to the bit bucket.
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltwaterC committed Jun 15, 2012
1 parent 9b5b5e9 commit b450978
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/http-get.js
Expand Up @@ -73,8 +73,15 @@ var get = function (options, file, cb, reqId) {
}
}
} else {
file = String(file).trim();
file = p.resolve(file);
if (file !== null) {
file = String(file).trim();
file = p.resolve(file);
} else {
file = tools.getDaveNull();
if (options.debug) {
console.error('Dave Null is: %s', file);
}
}
}

if ( ! options.url) {
Expand Down
23 changes: 23 additions & 0 deletions tests/response-file-null.js
@@ -0,0 +1,23 @@
var http = require('../');

var assert = require('assert');
var common = require('./includes/common.js');

var callback = false;

var server = common.createFooServer(false, function () {
http.get({url: common.options.url}, null, function (err, res) {
callback = true;
assert.ifError(err);
if (process.platform === 'win32') {
assert.deepEqual('NUL:', res.file);
} else {
assert.deepEqual('/dev/null', res.file);
}
server.close();
});
});

process.on('exit', function () {
assert.ok(callback);
});

0 comments on commit b450978

Please sign in to comment.