I noticed missing parameter validation in the setCookie function:
|
CookieJar.prototype.setCookie = function(cookie, url, options, cb) { |
|
var err; |
|
var context = getCookieContext(url); |
|
if (options instanceof Function) { |
|
cb = options; |
|
options = {}; |
|
} |
There is no parameter validation which may cause confusion when not setting url. If only cookies then the function will assume that the options parameter is an object and tries to access the loose property. This will cause a TypeException.
There should either be parameter validation throwing an Error or some kind of handling.
This was found when investigating this bug: valeriangalliat/fetch-cookie#35
I noticed missing parameter validation in the
setCookiefunction:tough-cookie/lib/cookie.js
Lines 995 to 1001 in 4350705
There is no parameter validation which may cause confusion when not setting
url. If onlycookiesthen the function will assume that theoptionsparameter is an object and tries to access thelooseproperty. This will cause a TypeException.There should either be parameter validation throwing an Error or some kind of handling.
This was found when investigating this bug: valeriangalliat/fetch-cookie#35