Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should set cookies', function () { // eslint-disable-line jasmine/no-spec-dupes
var accessInfo, cookies;
accessInfo = new CookieAccessInfo(domain, '/', true, false);
cookies = agent.cookieJar.getCookies(accessInfo);
cookies.length.should.eql(1);
});
});
this.cache.getHeaders(url, function (c) {
if (c) {
if (c['last-modifed']) {
h['if-modified-since'] = c['last-modified'];
}
if (c.etag) {
h['if-none-match'] = c.etag;
}
}
var cookies = self.jar.getCookies(cookiejar.CookieAccessInfo(u.host, u.pathname));
if (cookies) {
h.cookie = cookies.join(";");
}
request.get({url:url, headers:h, pool:self.pool}, function (e, resp, body) {
self.emit('log', debug, 'Response received for '+url+'.')
if (e) {
self.emit('log', error, e);
return;
}
if (resp.statusCode === 304) {
self.cache.get(url, function (c_) {
self._handler(url, referer, {fromCache:true, headers:c_.headers, body:c_.body})
});
return;
} else if (resp.statusCode !== 200) {
Assertion.addMethod('cookie', function (key, value) {
var header = getHeader(this._obj, 'set-cookie')
, cookie;
if (!header) {
header = (getHeader(this._obj, 'cookie') || '').split(';');
}
cookie = Cookie.CookieJar();
cookie.setCookies(header);
cookie = cookie.getCookie(key, new Cookie.CookieAccessInfo());
if (arguments.length === 2) {
this.assert(
cookie.value == value
, 'expected cookie \'' + key + '\' to have value #{exp} but got #{act}'
, 'expected cookie \'' + key + '\' to not have value #{exp}'
, value
, cookie.value
);
} else {
this.assert(
'undefined' !== typeof cookie || null === cookie
, 'expected cookie \'' + key + '\' to exist'
, 'expected cookie \'' + key + '\' to not exist'
);
}
Agent.prototype.attachCookies = function(req){
var url = parse(req.url);
var access = CookieAccess(url.host, url.pathname, 'https:' == url.protocol);
var cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};
getCookies = ({domain, path = '/', secure = true, script = false}) =>
cookieJar.getCookies(new CookieAccessInfo(domain, path, secure, script)),
Agent.prototype.attachCookies = function(req){
var url = parse(req.url);
var access = CookieAccess(url.host, url.pathname, 'https:' == url.protocol);
var cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};
Agent.prototype._attachCookies = function(req) {
const url = parse(req.url);
const access = new CookieAccessInfo(
url.hostname,
url.pathname,
url.protocol === 'https:'
);
const cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};
Agent.prototype._attachCookies = function(req) {
const url = parse(req.url);
const access = CookieAccess(
url.hostname,
url.pathname,
'https:' == url.protocol
);
const cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};
Agent.prototype.attachCookies = function(req){
var url = parse(req.url);
var access = CookieAccess(url.hostname, url.pathname, 'https:' == url.protocol);
var cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};
Agent.prototype._attachCookies = function(req) {
const url = parse(req.url);
const access = CookieAccess(
url.hostname,
url.pathname,
'https:' == url.protocol
);
const cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
};