@sap-ux/axios-extension 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ class Cookies {
42
42
  addCookie(cookieString) {
43
43
  var _a;
44
44
  const cookie = cookieString.split(';');
45
- const [key, ...values] = (_a = cookie[0]) === null || _a === void 0 ? void 0 : _a.split('=');
45
+ const [key, ...values] = ((_a = cookie[0]) === null || _a === void 0 ? void 0 : _a.split('=')) || [];
46
46
  const value = values === null || values === void 0 ? void 0 : values.join('='); // Account for embedded '=' in the value
47
47
  if (key && cookieString.indexOf('Max-Age=0') >= 0) {
48
48
  delete this.cookies[key];
@@ -141,7 +141,6 @@ function attachConnectionHandler(provider) {
141
141
  var _a;
142
142
  request.headers = (_a = request.headers) !== null && _a !== void 0 ? _a : {};
143
143
  request.headers[CSRF.RequestHeaderName] = CSRF.RequestHeaderValue;
144
- provider.interceptors.request.eject(oneTimeReqInterceptorId);
145
144
  return request;
146
145
  });
147
146
  // throw error if the user is unauthorized otherwise, remove interceptor if successfully connected
@@ -159,6 +158,7 @@ function attachConnectionHandler(provider) {
159
158
  if ((_c = response.headers) === null || _c === void 0 ? void 0 : _c[CSRF.ResponseHeaderName]) {
160
159
  provider.defaults.headers.common[CSRF.RequestHeaderName] =
161
160
  response.headers[CSRF.ResponseHeaderName];
161
+ provider.interceptors.request.eject(oneTimeReqInterceptorId);
162
162
  }
163
163
  provider.interceptors.response.eject(oneTimeRespInterceptorId);
164
164
  return response;
@@ -170,6 +170,7 @@ function attachConnectionHandler(provider) {
170
170
  if ((_a = error.response.headers) === null || _a === void 0 ? void 0 : _a[CSRF.ResponseHeaderName]) {
171
171
  provider.defaults.headers.common[CSRF.RequestHeaderName] =
172
172
  error.response.headers[CSRF.ResponseHeaderName];
173
+ provider.interceptors.request.eject(oneTimeReqInterceptorId);
173
174
  }
174
175
  provider.cookies.setCookies(error.response);
175
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Extension of the Axios module adding convinience methods to interact with SAP systems especially with OData services.",
5
5
  "repository": {
6
6
  "type": "git",