Skip to content

Commit

Permalink
Remove instanceof check for CookieJar (mikeal suggestion)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessioalex committed Nov 13, 2011
1 parent fc44260 commit 366831b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
5 changes: 1 addition & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ Request.prototype.request = function () {
setHost = true
}

// if user tries to define a bad cookie jar
if (self.jar && !(self.jar instanceof CookieJar)) {
throw new Error("Argument error, options.jar.")
} else if (self.jar) {
if (self.jar) {
// fetch cookie from the user defined cookie jar
var cookies = self.jar.get({ url: self.uri.href })
} else {
Expand Down
7 changes: 0 additions & 7 deletions tests/test-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ try {
assert.equal(e.message, 'Argument error, options.multipart.')
}

try {
request({uri:local, jar: 'foo'})
assert.fail("Should have throw")
} catch(e) {
assert.equal(e.message, 'Argument error, options.jar.')
}

try {
request({uri:local, multipart: [{}]})
assert.fail("Should have throw")
Expand Down

0 comments on commit 366831b

Please sign in to comment.