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

rest-client-sdk

Package Overview
Dependencies
Maintainers
3
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-client-sdk - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

6

CHANGELOG.md
# Changelog
## 3.1.1
### Changed
* Read json response in \_manageUnauthorized when www-authenticate header is not available
## 3.1.0

@@ -4,0 +10,0 @@

18

dist/index.es.js

@@ -1093,2 +1093,4 @@ import diff from 'deep-diff';

value: function _manageUnauthorized(response, input, init) {
var _this5 = this;
// https://tools.ietf.org/html/rfc2617#section-1.2

@@ -1101,4 +1103,14 @@ var authorizationHeader = response.headers.get('www-authenticate');

}
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
} else {
// if www-authenticate header is missing, try and read json response
return response.json().then(function (body) {
if (_this5._tokenStorage && body.error === 'invalid_grant') {
return _this5._refreshTokenAndRefetch(response, input, init);
}
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
}).catch(function () {
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
});
}
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
}

@@ -1108,3 +1120,3 @@ }, {

value: function _doFetch(accessToken, input, init) {
var _this5 = this;
var _this6 = this;

@@ -1145,3 +1157,3 @@ var params = init;

if (response.status === 401) {
return _this5._manageUnauthorized(response, input, params);
return _this6._manageUnauthorized(response, input, params);
}

@@ -1148,0 +1160,0 @@

@@ -1099,2 +1099,4 @@ (function (global, factory) {

value: function _manageUnauthorized(response, input, init) {
var _this5 = this;
// https://tools.ietf.org/html/rfc2617#section-1.2

@@ -1107,4 +1109,14 @@ var authorizationHeader = response.headers.get('www-authenticate');

}
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
} else {
// if www-authenticate header is missing, try and read json response
return response.json().then(function (body) {
if (_this5._tokenStorage && body.error === 'invalid_grant') {
return _this5._refreshTokenAndRefetch(response, input, init);
}
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
}).catch(function () {
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
});
}
throw new UnauthorizedError('Unable to access ressource: 401 found !', response);
}

@@ -1114,3 +1126,3 @@ }, {

value: function _doFetch(accessToken, input, init) {
var _this5 = this;
var _this6 = this;

@@ -1151,3 +1163,3 @@ var params = init;

if (response.status === 401) {
return _this5._manageUnauthorized(response, input, params);
return _this6._manageUnauthorized(response, input, params);
}

@@ -1154,0 +1166,0 @@

6

package.json
{
"name": "rest-client-sdk",
"version": "v3.1.0",
"version": "v3.1.1",
"description": "Rest Client SDK for API",

@@ -38,3 +38,3 @@ "main": "dist/index.js",

"immutable": "^4.0.0-rc.9",
"jest": "^23.1.0",
"jest": "^23.1.1",
"lint-staged": "^7.0.3",

@@ -47,3 +47,3 @@ "pluralize": "^7.0.0",

"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.1.0"
"rollup-plugin-node-resolve": "^3.1.1"
},

@@ -50,0 +50,0 @@ "optionalDependencies": {

@@ -263,7 +263,26 @@ import URI from 'urijs';

}
throw new UnauthorizedError(
'Unable to access ressource: 401 found !',
response
);
} else {
// if www-authenticate header is missing, try and read json response
return response
.json()
.then(body => {
if (this._tokenStorage && body.error === 'invalid_grant') {
return this._refreshTokenAndRefetch(response, input, init);
}
throw new UnauthorizedError(
'Unable to access ressource: 401 found !',
response
);
})
.catch(() => {
throw new UnauthorizedError(
'Unable to access ressource: 401 found !',
response
);
});
}
throw new UnauthorizedError(
'Unable to access ressource: 401 found !',
response
);
}

@@ -270,0 +289,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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