cookie-api-handler
TypeScript icon, indicating that this package has built-in type declarations

2.25.15 • Public • Published

Cookie API Handler

npm version renovate-app Known Vulnerabilities codecov travis

Extension of rest-api-handler library. It parse cookies from response headers and use them to send requests.

Library is compiled for node 9.6 and include Fetch polyfill.

How to use it

Install the library:

npm install cookie-api-handler

Send requests:

const CookieApi = require('cookie-api-handler');

(async () => {
    const api = new CookieApi('');

    await api.get('https://endomondo.com');

    console.log(api.getCookies());
})();

For more information about sending requests, check base library.

How to work with cookies

Cookies are inserted to object based on response headers. Class have methods to add custom cookies and read the current ones:

// will return object of decoded strings
api.getCookies();


// you can add custom cookies, string only. Cookies will be encoded.
api.addCookies({
    cookieName: 'cookieValue',
});

Readme

Keywords

Package Sidebar

Install

npm i cookie-api-handler

Weekly Downloads

3

Version

2.25.15

License

Apache-2.0

Unpacked Size

42.3 kB

Total Files

12

Last publish

Collaborators

  • fabulator