Cookie API Handler
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:
api.getCookies();
api.addCookies({
cookieName: 'cookieValue',
});