Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@3846masa/axios-cookiejar-support

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@3846masa/axios-cookiejar-support - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

22

lib/request-interceptor-wrapper.js
'use strict';
const pify = require('pify');
function requestInterceptorResolve (config) {

@@ -31,9 +33,15 @@ return Promise.resolve(config)

if (local.jar && config.withCredentials) {
const cookieString = local.jar.getCookieStringSync(config.url);
if (cookieString) {
config.headers['Cookie'] =
(config.headers['Cookie'])
? cookieString + '; ' + config.headers['Cookie']
: cookieString;
}
const getCookieString =
pify(local.jar.getCookieString.bind(local.jar));
return getCookieString(config.url)
.then(function (cookieString) {
if (!cookieString) {
return;
}
config.headers['Cookie'] =
(config.headers['Cookie'])
? cookieString + '; ' + config.headers['Cookie']
: cookieString;
}).then(function () { return config; });
}

@@ -40,0 +48,0 @@

@@ -5,2 +5,3 @@ 'use strict';

const settle = require('axios/lib/core/settle');
const pify = require('pify');

@@ -12,2 +13,3 @@ function responseInterceptorResolve (response, instance) {

const local = config._COOKIEJAR_SUPPORT_LOCAL;
if (!local.jar || !response.headers['set-cookie']) {

@@ -17,13 +19,17 @@ return response;

const setCookie = pify(local.jar.setCookie.bind(local.jar));
const setCookiePromiseList = [];
if (Array.isArray(response.headers['set-cookie'])) {
const cookies = response.headers['set-cookie'];
cookies.forEach(function (cookie) {
local.jar.setCookieSync(cookie, config.url);
setCookiePromiseList.push(setCookie(cookie, config.url));
});
} else {
const cookie = response.headers['set-cookie'];
local.jar.setCookieSync(cookie, config.url);
setCookiePromiseList.push(setCookie(cookie, config.url));
}
return response;
return Promise.all(setCookiePromiseList)
.then(function () { return response; });
})

@@ -30,0 +36,0 @@ .then(function redirectSetup (response) {

{
"name": "@3846masa/axios-cookiejar-support",
"description": "Add tough-cookie support to axios.",
"version": "0.1.0",
"version": "0.1.1",
"author": "3846masa",

@@ -14,2 +14,3 @@ "browser": {

"@types/tough-cookie": "^2.3.1",
"pify": "3.0.0",
"tough-cookie": "2.3.2"

@@ -16,0 +17,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc