How to use the cookiejar.CookieAccessInfo function in cookiejar

To help you get started, we’ve selected a few cookiejar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github srveit / mechanize-js / spec / agent_spec.js View on Github external
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);
      });
    });
github mikeal / spider / main.js View on Github external
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) {
github chaijs / chai-http / dist / chai-http.js View on Github external
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'
      );
    }
github aredotna / ervell / node_modules / arena-passport / node_modules / superagent / lib / node / agent.js View on Github external
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;
};
github srveit / mechanize-js / lib / mechanize / agent.js View on Github external
getCookies = ({domain, path = '/', secure = true, script = false}) =>
      cookieJar.getCookies(new CookieAccessInfo(domain, path, secure, script)),
github nfriedly / nfriedly.com / node_modules / docpad / node_modules / superagent / lib / node / agent.js View on Github external
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;
};
github visionmedia / superagent / src / node / agent.js View on Github external
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;
};
github AntSwordProject / antSword / node_modules / superagent / lib / node / agent.js View on Github external
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;
};
github aredotna / ervell / node_modules / backbone-super-sync / node_modules / superagent / lib / node / agent.js View on Github external
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;
};
github visionmedia / superagent / lib / node / agent.js View on Github external
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;
};

cookiejar

simple persistent cookiejar system

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis

Similar packages