Skip to content

Commit

Permalink
Adding support for request(url)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Apr 17, 2011
1 parent 4d7a6d4 commit 243a565
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ var Request = function (options) {
this.readable = true;
this.writable = true;

if (typeof options === 'string') {
options = {uri:options};
}

for (i in options) {
this[i] = options[i];
}
Expand Down Expand Up @@ -310,6 +314,7 @@ Request.prototype.resume = function () {
}

function request (options, callback) {
if (typeof options === 'string') options = {uri:options};
if (callback) options.callback = callback;
var r = new Request(options);
r.request();
Expand Down

0 comments on commit 243a565

Please sign in to comment.