Skip to content

Instantly share code, notes, and snippets.

View HamidTanhaei's full-sized avatar
🙂
Always Working

Hamid Tanhaei HamidTanhaei

🙂
Always Working
View GitHub Profile
@HamidTanhaei
HamidTanhaei / axiosInterceptor.js
Created December 28, 2020 09:22 — forked from nzvtrk/axiosInterceptor.js
Axios create/recreate cookie session in node.js enviroment
/* Basic example of save cookie using axios in node.js and recreate session if it expired.
* Get/save cookie manually cause WithCredential axios param use XHR and not work in node.js
* Supports parallel request and send only one create session request.
* */
const BASE_URL = "https://google.com";
// Init instance of axios which works with BASE_URL
const axiosInstance = axios.create({ baseURL: BASE_URL });