How to use the cookiejar.Cookie 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 voxpelli / node-connect-pg-simple / test / integration / express.spec.js View on Github external
.then(res => {
          const sessionCookie = new Cookie(res.header['set-cookie'][0]);
          const cookieValue = decodeURIComponent(sessionCookie.value);

          cookieValue.substr(0, 2).should.equal('s:');

          return signature.unsign(cookieValue.substr(2), secret);
        })
        .then(decodedCookie => queryPromise('SELECT sid FROM session WHERE sid = $1', [decodedCookie]))
github mixer / wsabi / lib / jar.js View on Github external
Jar.prototype.setCookies = function (cookies) {
    cookies = Array.isArray(cookies) ? cookies : cookies.split('; ');

    for (let i = 0; i < cookies.length; i++) {
        const cookie = new Cookie.Cookie(cookies[i].trim());
        this.cookies[cookie.name] = cookie;
    }
};
github srveit / mechanize-js / spec / agent_spec.js View on Github external
beforeEach(function () {
          cookie = new Cookie('sessionid=123;domain=.example.com;path=/');
          agent.cookieJar.setCookie(cookie);
          contentType = 'application/x-www-form-urlencoded';
          form.method = 'POST';
          form.enctype = contentType;
          agent.submit(form, null, {}, {}, function (err, page) {
            submitErr = err;
            submitPage = page;
          });
        });
github srveit / mechanize-js / lib / mechanize / agent.js View on Github external
.forEach(cookieStr => {
          const cookie = new Cookie(cookieStr);
          if (!cookie.domain) {
            cookie.domain = domain;
          }
          if (!cookie.path) {
            cookie.path = path;
          }
          cookieJar.setCookie(cookie);
        });
    },
github srveit / mechanize-js / examples / submit_form.js View on Github external
submitExample = async url => {
    const agent = newAgent(),
      cookie = new Cookie("sessionid=123;domain=.example.com;path=/"),
      username = "MYUSERNAME",
      password = "MYPASSWORD",
      requestData = 'username='+username+'&password='+password,
      form = {
        page: {uri: url},
        action: 'login',
        method: 'POST',
        enctype: 'application/x-www-form-urlencoded',
        requestData: () => {
          return requestData;
        },
        addButtonToQuery: () => {}
      };

    agent.setCookie(cookie);

cookiejar

simple persistent cookiejar system

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis

Similar packages