@ama-sdk/core 11.0.0-next.0 → 11.0.0-next.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.
- package/README.md +4 -1
- package/cjs/clients/api-angular-client.js +45 -23
- package/cjs/clients/api-beacon-client.js +64 -20
- package/cjs/clients/api-fetch-client.js +66 -21
- package/cjs/fwk/Reviver.js +7 -7
- package/cjs/fwk/api.helper.spec.js +20 -20
- package/cjs/fwk/api.helpers.js +14 -14
- package/cjs/fwk/core/api-client.js +1 -1
- package/cjs/fwk/core/base-api-constructor.js +1 -1
- package/cjs/fwk/date.js +9 -9
- package/cjs/fwk/date.spec.js +25 -25
- package/cjs/fwk/errors.js +3 -3
- package/cjs/fwk/mocks/alf-mock-adapter.js +4 -4
- package/cjs/fwk/mocks/base-mock-adapter.js +2 -2
- package/cjs/fwk/mocks/helpers.js +3 -3
- package/cjs/fwk/reviver.spec.js +46 -10
- package/cjs/plugins/additional-params/additional-params-sync.request.js +2 -2
- package/cjs/plugins/additional-params/additional-params.request.js +3 -3
- package/cjs/plugins/additional-params/additional-params.spec.js +30 -30
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
- package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +13 -13
- package/cjs/plugins/api-key/api-key.request.js +2 -2
- package/cjs/plugins/api-key/api-key.spec.js +11 -11
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +6 -5
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +33 -33
- package/cjs/plugins/client-facts/client-facts.request.js +3 -3
- package/cjs/plugins/client-facts/client-facts.spec.js +27 -27
- package/cjs/plugins/concurrent/concurrent.fetch.js +1 -0
- package/cjs/plugins/concurrent/concurrent.spec.js +4 -4
- package/cjs/plugins/custom-info/custom-info.spec.js +15 -15
- package/cjs/plugins/exception/exception.reply.js +2 -2
- package/cjs/plugins/exception/exception.spec.js +15 -15
- package/cjs/plugins/fetch-cache/fetch-cache.request.js +4 -4
- package/cjs/plugins/fetch-cache/fetch-cache.spec.js +20 -20
- package/cjs/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
- package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +8 -8
- package/cjs/plugins/json-token/json-token.reply.js +5 -5
- package/cjs/plugins/json-token/json-token.request.js +4 -4
- package/cjs/plugins/json-token/json-token.spec.js +24 -24
- package/cjs/plugins/keepalive/keepalive.request.js +2 -2
- package/cjs/plugins/keepalive/keepalive.spec.js +4 -4
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +32 -40
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +30 -26
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.interface.js +2 -2
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +28 -28
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
- package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +9 -9
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +11 -11
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +94 -94
- package/cjs/plugins/raw-response-info/raw-response-info.spec.js +12 -12
- package/cjs/plugins/retry/retry.spec.js +20 -20
- package/cjs/plugins/reviver/reviver.reply.js +35 -2
- package/cjs/plugins/reviver/reviver.spec.js +6 -6
- package/cjs/plugins/session-id/session-id.request.js +7 -6
- package/cjs/plugins/session-id/session-id.spec.js +13 -13
- package/cjs/plugins/si-token/si-token.spec.js +9 -9
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +4 -4
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +44 -44
- package/cjs/plugins/timeout/timeout.fetch.js +12 -10
- package/cjs/plugins/timeout/timeout.spec.js +13 -13
- package/cjs/plugins/url-rewrite/url-rewrite.spec.js +9 -9
- package/cjs/plugins/wait-for/wait-for.spec.js +9 -9
- package/cjs/utils/crypto.js +14 -14
- package/cjs/utils/generic-api.js +253 -0
- package/cjs/utils/index.js +1 -0
- package/cjs/utils/json-token.js +30 -30
- package/cjs/utils/json-token.spec.js +31 -31
- package/cli/files-pack.cjs +12 -12
- package/cli/files-pack.cjs.map +1 -1
- package/esm2015/clients/api-angular-client.js +49 -27
- package/esm2015/clients/api-beacon-client.js +65 -21
- package/esm2015/clients/api-fetch-client.js +70 -25
- package/esm2015/clients/index.js +2 -2
- package/esm2015/fwk/Reviver.js +10 -7
- package/esm2015/fwk/api.helper.spec.js +21 -21
- package/esm2015/fwk/api.helpers.js +14 -14
- package/esm2015/fwk/core/api-client.js +1 -1
- package/esm2015/fwk/core/base-api-constructor.js +1 -1
- package/esm2015/fwk/core/index.js +2 -2
- package/esm2015/fwk/date.js +9 -9
- package/esm2015/fwk/date.spec.js +26 -26
- package/esm2015/fwk/errors.js +3 -3
- package/esm2015/fwk/index.js +10 -10
- package/esm2015/fwk/mocks/alf-mock-adapter.js +6 -6
- package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
- package/esm2015/fwk/mocks/helpers.js +3 -3
- package/esm2015/fwk/mocks/index.js +10 -10
- package/esm2015/fwk/mocks/random-mock-adapter.js +1 -1
- package/esm2015/fwk/mocks/sequential-mock-adapter.js +1 -1
- package/esm2015/fwk/reviver.spec.js +47 -11
- package/esm2015/plugins/additional-params/additional-params-sync.request.js +3 -3
- package/esm2015/plugins/additional-params/additional-params.request.js +3 -3
- package/esm2015/plugins/additional-params/additional-params.spec.js +32 -32
- package/esm2015/plugins/additional-params/index.js +2 -2
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
- package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +14 -14
- package/esm2015/plugins/api-configuration-override/index.js +1 -1
- package/esm2015/plugins/api-key/api-key.request.js +2 -2
- package/esm2015/plugins/api-key/api-key.spec.js +12 -12
- package/esm2015/plugins/api-key/index.js +1 -1
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +6 -6
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +34 -34
- package/esm2015/plugins/bot-protection-fingerprint/index.js +1 -1
- package/esm2015/plugins/client-facts/client-facts.request.js +4 -4
- package/esm2015/plugins/client-facts/client-facts.spec.js +28 -28
- package/esm2015/plugins/client-facts/index.js +1 -1
- package/esm2015/plugins/concurrent/concurrent.fetch.js +1 -0
- package/esm2015/plugins/concurrent/concurrent.spec.js +5 -5
- package/esm2015/plugins/concurrent/index.js +1 -1
- package/esm2015/plugins/core/index.js +4 -4
- package/esm2015/plugins/custom-info/custom-info.spec.js +17 -17
- package/esm2015/plugins/custom-info/index.js +1 -1
- package/esm2015/plugins/exception/exception.reply.js +4 -4
- package/esm2015/plugins/exception/exception.spec.js +18 -18
- package/esm2015/plugins/exception/index.js +1 -1
- package/esm2015/plugins/fetch-cache/fetch-cache.request.js +4 -4
- package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +21 -21
- package/esm2015/plugins/fetch-cache/index.js +1 -1
- package/esm2015/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
- package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +9 -9
- package/esm2015/plugins/fetch-credentials/index.js +1 -1
- package/esm2015/plugins/index.js +25 -25
- package/esm2015/plugins/json-token/index.js +2 -2
- package/esm2015/plugins/json-token/json-token.reply.js +5 -5
- package/esm2015/plugins/json-token/json-token.request.js +4 -4
- package/esm2015/plugins/json-token/json-token.spec.js +27 -27
- package/esm2015/plugins/keepalive/index.js +1 -1
- package/esm2015/plugins/keepalive/keepalive.request.js +2 -2
- package/esm2015/plugins/keepalive/keepalive.spec.js +5 -5
- package/esm2015/plugins/mgw-mdw-auth/index.js +1 -1
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +34 -42
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +32 -28
- package/esm2015/plugins/mock-intercept/index.js +2 -2
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -5
- package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +2 -2
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +4 -4
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +32 -32
- package/esm2015/plugins/perf-metric/index.js +1 -1
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -2
- package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +10 -10
- package/esm2015/plugins/pii-tokenizer/index.js +1 -1
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -12
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +96 -96
- package/esm2015/plugins/raw-response-info/index.js +1 -1
- package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +14 -14
- package/esm2015/plugins/retry/index.js +1 -1
- package/esm2015/plugins/retry/retry.fetch.js +1 -1
- package/esm2015/plugins/retry/retry.spec.js +21 -21
- package/esm2015/plugins/reviver/index.js +1 -1
- package/esm2015/plugins/reviver/reviver.reply.js +35 -2
- package/esm2015/plugins/reviver/reviver.spec.js +8 -8
- package/esm2015/plugins/session-id/index.js +1 -1
- package/esm2015/plugins/session-id/session-id.request.js +8 -7
- package/esm2015/plugins/session-id/session-id.spec.js +14 -14
- package/esm2015/plugins/si-token/index.js +1 -1
- package/esm2015/plugins/si-token/si-token.request.js +1 -1
- package/esm2015/plugins/si-token/si-token.spec.js +10 -10
- package/esm2015/plugins/simple-api-key-authentication/index.js +1 -1
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +5 -5
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +46 -46
- package/esm2015/plugins/timeout/index.js +1 -1
- package/esm2015/plugins/timeout/timeout.fetch.js +13 -11
- package/esm2015/plugins/timeout/timeout.spec.js +15 -15
- package/esm2015/plugins/url-rewrite/index.js +1 -1
- package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +10 -10
- package/esm2015/plugins/wait-for/index.js +1 -1
- package/esm2015/plugins/wait-for/wait-for.spec.js +10 -10
- package/esm2015/public_api.js +4 -4
- package/esm2015/utils/crypto.js +15 -15
- package/esm2015/utils/generic-api.js +245 -0
- package/esm2015/utils/index.js +6 -5
- package/esm2015/utils/json-token.js +32 -32
- package/esm2015/utils/json-token.spec.js +32 -32
- package/package.json +67 -40
- package/schematics/ng-add/index.d.ts +4 -2
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +58 -40
- package/schematics/ng-add/index.js.map +1 -1
- package/src/clients/api-angular-client.d.ts +6 -3
- package/src/clients/api-angular-client.d.ts.map +1 -1
- package/src/clients/api-angular-client.js +31 -16
- package/src/clients/api-angular-client.js.map +1 -1
- package/src/clients/api-beacon-client.d.ts +7 -5
- package/src/clients/api-beacon-client.d.ts.map +1 -1
- package/src/clients/api-beacon-client.js +24 -14
- package/src/clients/api-beacon-client.js.map +1 -1
- package/src/clients/api-fetch-client.d.ts +5 -3
- package/src/clients/api-fetch-client.d.ts.map +1 -1
- package/src/clients/api-fetch-client.js +26 -14
- package/src/clients/api-fetch-client.js.map +1 -1
- package/src/fwk/Reviver.d.ts +16 -4
- package/src/fwk/Reviver.d.ts.map +1 -1
- package/src/fwk/Reviver.js +9 -6
- package/src/fwk/Reviver.js.map +1 -1
- package/src/fwk/api.helpers.d.ts +1 -1
- package/src/fwk/api.helpers.d.ts.map +1 -1
- package/src/fwk/api.helpers.js +1 -1
- package/src/fwk/api.helpers.js.map +1 -1
- package/src/fwk/core/api-client.d.ts +36 -1
- package/src/fwk/core/api-client.d.ts.map +1 -1
- package/src/fwk/core/api-client.js.map +1 -1
- package/src/fwk/date.js.map +1 -1
- package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/helpers.js.map +1 -1
- package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
- package/src/fwk/mocks/sequential-mock-adapter.js.map +1 -1
- package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
- package/src/plugins/additional-params/additional-params.request.js.map +1 -1
- package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +1 -1
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +1 -1
- package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
- package/src/plugins/client-facts/client-facts.request.js.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
- package/src/plugins/concurrent/concurrent.fetch.js +1 -0
- package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
- package/src/plugins/core/plugin.d.ts +6 -1
- package/src/plugins/core/plugin.d.ts.map +1 -1
- package/src/plugins/core/reply-plugin.d.ts +0 -2
- package/src/plugins/core/reply-plugin.d.ts.map +1 -1
- package/src/plugins/core/request-plugin.d.ts +2 -0
- package/src/plugins/core/request-plugin.d.ts.map +1 -1
- package/src/plugins/exception/exception.reply.js.map +1 -1
- package/src/plugins/fetch-cache/fetch-cache.request.js.map +1 -1
- package/src/plugins/json-token/json-token.reply.js.map +1 -1
- package/src/plugins/json-token/json-token.request.js.map +1 -1
- package/src/plugins/keepalive/keepalive.request.js.map +1 -1
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts +2 -2
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +26 -28
- package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
- package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
- package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
- package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
- package/src/plugins/raw-response-info/raw-response-info.reply.js.map +1 -1
- package/src/plugins/retry/retry.fetch.js.map +1 -1
- package/src/plugins/reviver/reviver.reply.d.ts +7 -0
- package/src/plugins/reviver/reviver.reply.d.ts.map +1 -1
- package/src/plugins/reviver/reviver.reply.js +12 -1
- package/src/plugins/reviver/reviver.reply.js.map +1 -1
- package/src/plugins/session-id/session-id.request.d.ts +1 -0
- package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
- package/src/plugins/session-id/session-id.request.js +1 -0
- package/src/plugins/session-id/session-id.request.js.map +1 -1
- package/src/plugins/si-token/si-token.request.js.map +1 -1
- package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
- package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
- package/src/plugins/timeout/timeout.fetch.js +2 -0
- package/src/plugins/timeout/timeout.fetch.js.map +1 -1
- package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
- package/src/utils/crypto.js.map +1 -1
- package/src/utils/encoder.js.map +1 -1
- package/src/utils/generic-api.d.ts +39 -0
- package/src/utils/generic-api.d.ts.map +1 -0
- package/src/utils/generic-api.js +43 -0
- package/src/utils/generic-api.js.map +1 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.d.ts.map +1 -1
- package/src/utils/index.js +1 -0
- package/src/utils/index.js.map +1 -1
- package/src/utils/json-token.d.ts.map +1 -1
- package/src/utils/json-token.js.map +1 -1
|
@@ -43,7 +43,7 @@ function _define_property(obj, key, value) {
|
|
|
43
43
|
var JsonTokenRequest = /*#__PURE__*/ function() {
|
|
44
44
|
"use strict";
|
|
45
45
|
function JsonTokenRequest() {
|
|
46
|
-
var storageTokenKey = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
46
|
+
var storageTokenKey = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'DP_SDK_AUTH_TOKEN', sharedMemory = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
47
47
|
_class_call_check(this, JsonTokenRequest);
|
|
48
48
|
_define_property(this, "storageTokenKey", void 0);
|
|
49
49
|
_define_property(this, "sharedMemory", void 0);
|
|
@@ -58,10 +58,10 @@ var JsonTokenRequest = /*#__PURE__*/ function() {
|
|
|
58
58
|
return {
|
|
59
59
|
transform: function(data) {
|
|
60
60
|
// Handle Authorization Tokens
|
|
61
|
-
var token = typeof sessionStorage !==
|
|
61
|
+
var token = typeof sessionStorage !== 'undefined' ? sessionStorage.getItem(_this.storageTokenKey) : _this.sharedMemory[_this.storageTokenKey];
|
|
62
62
|
if (token) {
|
|
63
|
-
data.credentials =
|
|
64
|
-
data.headers.append(
|
|
63
|
+
data.credentials = 'same-origin';
|
|
64
|
+
data.headers.append('Authorization', token);
|
|
65
65
|
}
|
|
66
66
|
return data;
|
|
67
67
|
}
|
|
@@ -129,25 +129,25 @@ function _ts_generator(thisArg, body) {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
describe(
|
|
133
|
-
var tokenValue =
|
|
134
|
-
var tokenKey =
|
|
135
|
-
describe(
|
|
132
|
+
describe('Json Token', function() {
|
|
133
|
+
var tokenValue = 'tokenValue';
|
|
134
|
+
var tokenKey = 'testToken';
|
|
135
|
+
describe('request plugin', function() {
|
|
136
136
|
var defaultGetParams = {
|
|
137
|
-
defaultTest:
|
|
137
|
+
defaultTest: 'ok'
|
|
138
138
|
};
|
|
139
|
-
var defaultBody =
|
|
139
|
+
var defaultBody = 'default';
|
|
140
140
|
var options;
|
|
141
141
|
beforeEach(function() {
|
|
142
142
|
options = {
|
|
143
|
-
method:
|
|
143
|
+
method: 'get',
|
|
144
144
|
queryParams: defaultGetParams,
|
|
145
145
|
headers: new Headers(),
|
|
146
146
|
body: defaultBody,
|
|
147
|
-
basePath:
|
|
147
|
+
basePath: 'http://test.com/truc'
|
|
148
148
|
};
|
|
149
149
|
});
|
|
150
|
-
it(
|
|
150
|
+
it('should add Authorization header', /*#__PURE__*/ _async_to_generator(function() {
|
|
151
151
|
var memory, plugin, runner, result;
|
|
152
152
|
return _ts_generator(this, function(_state) {
|
|
153
153
|
switch(_state.label){
|
|
@@ -157,8 +157,8 @@ describe("Json Token", function() {
|
|
|
157
157
|
};
|
|
158
158
|
plugin = new _jsontokenrequest.JsonTokenRequest(tokenKey, memory);
|
|
159
159
|
runner = plugin.load();
|
|
160
|
-
if (typeof window !==
|
|
161
|
-
jest.spyOn(window.sessionStorage,
|
|
160
|
+
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
161
|
+
jest.spyOn(window.sessionStorage, 'getItem').mockImplementation(function() {
|
|
162
162
|
return tokenValue;
|
|
163
163
|
});
|
|
164
164
|
}
|
|
@@ -168,18 +168,18 @@ describe("Json Token", function() {
|
|
|
168
168
|
];
|
|
169
169
|
case 1:
|
|
170
170
|
result = _state.sent();
|
|
171
|
-
if (typeof window !==
|
|
171
|
+
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
172
172
|
expect(window.sessionStorage.getItem).toHaveBeenCalledWith(tokenKey);
|
|
173
173
|
}
|
|
174
|
-
expect(result.credentials).toBe(
|
|
175
|
-
expect(result.headers.get(
|
|
174
|
+
expect(result.credentials).toBe('same-origin');
|
|
175
|
+
expect(result.headers.get('Authorization')).toBe(tokenValue);
|
|
176
176
|
return [
|
|
177
177
|
2
|
|
178
178
|
];
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
}));
|
|
182
|
-
it(
|
|
182
|
+
it('should not add Authorization if no token', /*#__PURE__*/ _async_to_generator(function() {
|
|
183
183
|
var memory, plugin, runner, result;
|
|
184
184
|
return _ts_generator(this, function(_state) {
|
|
185
185
|
switch(_state.label){
|
|
@@ -189,8 +189,8 @@ describe("Json Token", function() {
|
|
|
189
189
|
};
|
|
190
190
|
plugin = new _jsontokenrequest.JsonTokenRequest(tokenKey, memory);
|
|
191
191
|
runner = plugin.load();
|
|
192
|
-
if (typeof window !==
|
|
193
|
-
jest.spyOn(window.sessionStorage,
|
|
192
|
+
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
193
|
+
jest.spyOn(window.sessionStorage, 'getItem').mockImplementation();
|
|
194
194
|
}
|
|
195
195
|
return [
|
|
196
196
|
4,
|
|
@@ -198,11 +198,11 @@ describe("Json Token", function() {
|
|
|
198
198
|
];
|
|
199
199
|
case 1:
|
|
200
200
|
result = _state.sent();
|
|
201
|
-
if (typeof window !==
|
|
201
|
+
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
202
202
|
expect(window.sessionStorage.getItem).toHaveBeenCalledWith(tokenKey);
|
|
203
203
|
}
|
|
204
204
|
expect(result.credentials).toBeUndefined();
|
|
205
|
-
expect(result.headers.get(
|
|
205
|
+
expect(result.headers.get('Authorization')).toBeNull();
|
|
206
206
|
return [
|
|
207
207
|
2
|
|
208
208
|
];
|
|
@@ -210,9 +210,9 @@ describe("Json Token", function() {
|
|
|
210
210
|
});
|
|
211
211
|
}));
|
|
212
212
|
});
|
|
213
|
-
describe(
|
|
213
|
+
describe('reply plugin', function() {
|
|
214
214
|
var reviver = jest.fn();
|
|
215
|
-
it(
|
|
215
|
+
it('should store the received token', /*#__PURE__*/ _async_to_generator(function() {
|
|
216
216
|
var memory, plugin, runner, data;
|
|
217
217
|
return _ts_generator(this, function(_state) {
|
|
218
218
|
switch(_state.label){
|
|
@@ -232,8 +232,8 @@ describe("Json Token", function() {
|
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
234
|
data = {};
|
|
235
|
-
if (typeof window !==
|
|
236
|
-
jest.spyOn(window.sessionStorage,
|
|
235
|
+
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
236
|
+
jest.spyOn(window.sessionStorage, 'setItem').mockImplementation();
|
|
237
237
|
}
|
|
238
238
|
return [
|
|
239
239
|
4,
|
|
@@ -241,7 +241,7 @@ describe("Json Token", function() {
|
|
|
241
241
|
];
|
|
242
242
|
case 1:
|
|
243
243
|
_state.sent();
|
|
244
|
-
if (typeof window !==
|
|
244
|
+
if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
|
|
245
245
|
expect(window.sessionStorage.setItem).toHaveBeenCalledWith(tokenKey, tokenValue);
|
|
246
246
|
} else {
|
|
247
247
|
expect(memory.testToken).toBe(tokenValue);
|
|
@@ -232,7 +232,7 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
232
232
|
switch(_state.label){
|
|
233
233
|
case 0:
|
|
234
234
|
customHeaders = new Headers();
|
|
235
|
-
customHeaders.set(
|
|
235
|
+
customHeaders.set('Content-Type', 'application/json');
|
|
236
236
|
_state.label = 1;
|
|
237
237
|
case 1:
|
|
238
238
|
_state.trys.push([
|
|
@@ -243,7 +243,7 @@ var KeepaliveRequest = /*#__PURE__*/ function() {
|
|
|
243
243
|
]);
|
|
244
244
|
return [
|
|
245
245
|
4,
|
|
246
|
-
fetch(
|
|
246
|
+
fetch('', {
|
|
247
247
|
headers: customHeaders,
|
|
248
248
|
keepalive: true
|
|
249
249
|
})
|
|
@@ -127,13 +127,13 @@ function _ts_generator(thisArg, body) {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
describe(
|
|
130
|
+
describe('Keepalive Request Plugin', function() {
|
|
131
131
|
var options = {
|
|
132
132
|
headers: new Headers(),
|
|
133
|
-
basePath:
|
|
134
|
-
method:
|
|
133
|
+
basePath: 'http://test.com/truc',
|
|
134
|
+
method: 'get'
|
|
135
135
|
};
|
|
136
|
-
it(
|
|
136
|
+
it('keepalive should be set to true', /*#__PURE__*/ _async_to_generator(function() {
|
|
137
137
|
var plugin, runner, keepalive;
|
|
138
138
|
return _ts_generator(this, function(_state) {
|
|
139
139
|
switch(_state.label){
|
|
@@ -20,7 +20,6 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
var _uuid = require("uuid");
|
|
23
|
-
var _crypto = require("../../utils/crypto");
|
|
24
23
|
var _jsontoken = require("../../utils/json-token");
|
|
25
24
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
26
25
|
try {
|
|
@@ -183,36 +182,24 @@ function sha256(value) {
|
|
|
183
182
|
}
|
|
184
183
|
function _sha256() {
|
|
185
184
|
_sha256 = _async_to_generator(function(value) {
|
|
185
|
+
var utf8, hashBuffer, hashArray, hashHex;
|
|
186
186
|
return _ts_generator(this, function(_state) {
|
|
187
187
|
switch(_state.label){
|
|
188
188
|
case 0:
|
|
189
|
-
|
|
190
|
-
3,
|
|
191
|
-
2
|
|
192
|
-
];
|
|
189
|
+
utf8 = new TextEncoder().encode(value);
|
|
193
190
|
return [
|
|
194
191
|
4,
|
|
195
|
-
crypto.subtle.digest(
|
|
192
|
+
(globalThis.crypto || require('node:crypto').webcrypto).subtle.digest('SHA-256', utf8)
|
|
196
193
|
];
|
|
197
194
|
case 1:
|
|
195
|
+
hashBuffer = _state.sent();
|
|
196
|
+
hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
197
|
+
hashHex = hashArray.map(function(bytes) {
|
|
198
|
+
return bytes.toString(16).padStart(2, '0');
|
|
199
|
+
}).join('');
|
|
198
200
|
return [
|
|
199
201
|
2,
|
|
200
|
-
|
|
201
|
-
_state.sent()
|
|
202
|
-
])
|
|
203
|
-
];
|
|
204
|
-
case 2:
|
|
205
|
-
// NodeJS
|
|
206
|
-
try {
|
|
207
|
-
return [
|
|
208
|
-
2,
|
|
209
|
-
(0, _crypto.ab2str)(require("node:crypto").createHash("sha256").update(value).digest("latin1"))
|
|
210
|
-
];
|
|
211
|
-
} catch (err) {
|
|
212
|
-
throw new Error("Crypto module is not available.");
|
|
213
|
-
}
|
|
214
|
-
return [
|
|
215
|
-
2
|
|
202
|
+
hashHex
|
|
216
203
|
];
|
|
217
204
|
}
|
|
218
205
|
});
|
|
@@ -221,16 +208,17 @@ function _sha256() {
|
|
|
221
208
|
}
|
|
222
209
|
function hmacSHA256(value, secretKey) {
|
|
223
210
|
try {
|
|
224
|
-
|
|
211
|
+
var createHmac = require('node:crypto').createHmac;
|
|
212
|
+
return createHmac('sha256', secretKey).update(value, 'latin1').digest('base64');
|
|
225
213
|
} catch (err) {
|
|
226
|
-
throw new Error(
|
|
214
|
+
throw new Error('Crypto module is not available.');
|
|
227
215
|
}
|
|
228
216
|
}
|
|
229
217
|
/**
|
|
230
218
|
* Header definition of the JWS used for the API Manager authentication
|
|
231
219
|
*/ var jwsHeader = {
|
|
232
|
-
alg:
|
|
233
|
-
typ:
|
|
220
|
+
alg: 'HS256',
|
|
221
|
+
typ: 'JWT'
|
|
234
222
|
};
|
|
235
223
|
var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
236
224
|
"use strict";
|
|
@@ -265,8 +253,8 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
265
253
|
/**
|
|
266
254
|
* Method used to encode a string in base64
|
|
267
255
|
*/ _define_property(this, "base64Encoder", void 0);
|
|
268
|
-
if (typeof window !==
|
|
269
|
-
throw new Error(
|
|
256
|
+
if (typeof window !== 'undefined') {
|
|
257
|
+
throw new Error('The plugin can only be used in a NodeJS context');
|
|
270
258
|
}
|
|
271
259
|
this.applicationId = options.applicationId;
|
|
272
260
|
this.expIntervalInSec = options.expIntervalInSec;
|
|
@@ -282,14 +270,16 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
282
270
|
value: /**
|
|
283
271
|
* Generates payload with minimal information
|
|
284
272
|
*/ function generatePayload() {
|
|
285
|
-
var
|
|
286
|
-
var
|
|
273
|
+
var nonce = this.base64Encoder((0, _uuid.v4)().toString());
|
|
274
|
+
var nowInSeconds = Math.floor(Date.now() / 1000);
|
|
275
|
+
var expTime = nowInSeconds + this.expIntervalInSec;
|
|
276
|
+
var context = this.base64Encoder(JSON.stringify(this.context));
|
|
287
277
|
return {
|
|
288
278
|
iss: this.applicationId,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
context:
|
|
279
|
+
exp: "".concat(expTime),
|
|
280
|
+
jti: nonce,
|
|
281
|
+
iat: "".concat(nowInSeconds),
|
|
282
|
+
context: context
|
|
293
283
|
};
|
|
294
284
|
}
|
|
295
285
|
},
|
|
@@ -302,20 +292,21 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
302
292
|
*/ function generateMicroGatewayAuthenticationSignatureKey(payload, basePath) {
|
|
303
293
|
var _this = this;
|
|
304
294
|
return _async_to_generator(function() {
|
|
305
|
-
var
|
|
295
|
+
var subKeyString, keyString, _;
|
|
306
296
|
return _ts_generator(this, function(_state) {
|
|
307
297
|
switch(_state.label){
|
|
308
298
|
case 0:
|
|
299
|
+
subKeyString = _this.secret + payload.jti + payload.iat + basePath;
|
|
309
300
|
_ = _this.apiKey;
|
|
310
301
|
return [
|
|
311
302
|
4,
|
|
312
|
-
sha256(
|
|
303
|
+
sha256(subKeyString)
|
|
313
304
|
];
|
|
314
305
|
case 1:
|
|
315
|
-
|
|
306
|
+
keyString = _ + _state.sent();
|
|
316
307
|
return [
|
|
317
308
|
2,
|
|
318
|
-
sha256(
|
|
309
|
+
sha256(keyString)
|
|
319
310
|
];
|
|
320
311
|
}
|
|
321
312
|
});
|
|
@@ -331,7 +322,8 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
331
322
|
*/ function sign(payload, secretKey) {
|
|
332
323
|
var message = "".concat(this.base64UrlEncoder(JSON.stringify(jwsHeader)), ".").concat(this.base64UrlEncoder(JSON.stringify(payload)));
|
|
333
324
|
var signature = hmacSHA256(message, secretKey);
|
|
334
|
-
|
|
325
|
+
var encodedSignature = (0, _jsontoken.base64EncodeUrl)(signature);
|
|
326
|
+
return "".concat(message, ".").concat(encodedSignature);
|
|
335
327
|
}
|
|
336
328
|
},
|
|
337
329
|
{
|
|
@@ -381,7 +373,7 @@ var MicroGatewayMiddlewareAuthenticationRequest = /*#__PURE__*/ function() {
|
|
|
381
373
|
];
|
|
382
374
|
case 1:
|
|
383
375
|
token = _state.sent();
|
|
384
|
-
data.headers.append("Bearer "
|
|
376
|
+
data.headers.append('Authorization', "Bearer ".concat(token));
|
|
385
377
|
return [
|
|
386
378
|
2,
|
|
387
379
|
data
|
|
@@ -146,7 +146,10 @@ function _ts_generator(thisArg, body) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
var authHeaderKey =
|
|
149
|
+
var authHeaderKey = 'Authorization';
|
|
150
|
+
var authHeaderPrefix = 'Bearer ';
|
|
151
|
+
var baseUrl = 'https://domain.com';
|
|
152
|
+
var routePath = '/v2/shopping/air-offers';
|
|
150
153
|
var options;
|
|
151
154
|
var FakeHeader = function FakeHeader() {
|
|
152
155
|
"use strict";
|
|
@@ -164,27 +167,27 @@ var FakeHeader = function FakeHeader() {
|
|
|
164
167
|
});
|
|
165
168
|
};
|
|
166
169
|
var jsonAuthTokenOptions = {
|
|
167
|
-
applicationId:
|
|
168
|
-
apiKey:
|
|
170
|
+
applicationId: '6X_MG__tester@test.com__PDT',
|
|
171
|
+
apiKey: 'dummy4P1K3Y',
|
|
169
172
|
expIntervalInSec: 60,
|
|
170
|
-
secret:
|
|
173
|
+
secret: 'super-secret',
|
|
171
174
|
context: {
|
|
172
|
-
oid:
|
|
175
|
+
oid: 'NCE1A0955'
|
|
173
176
|
}
|
|
174
177
|
};
|
|
175
|
-
describe(
|
|
178
|
+
describe('JSON auth token request plugin', function() {
|
|
176
179
|
beforeEach(function() {
|
|
177
180
|
options = {
|
|
178
|
-
basePath: "
|
|
181
|
+
basePath: "".concat(baseUrl).concat(routePath),
|
|
179
182
|
headers: new FakeHeader(),
|
|
180
|
-
method:
|
|
183
|
+
method: 'GET'
|
|
181
184
|
};
|
|
182
185
|
});
|
|
183
186
|
afterAll(function() {
|
|
184
187
|
global.sessionStorage = undefined;
|
|
185
188
|
});
|
|
186
|
-
it(
|
|
187
|
-
var plugin, result;
|
|
189
|
+
it('should add a Bearer in the header', /*#__PURE__*/ _async_to_generator(function() {
|
|
190
|
+
var _result_headers_get, plugin, result;
|
|
188
191
|
return _ts_generator(this, function(_state) {
|
|
189
192
|
switch(_state.label){
|
|
190
193
|
case 0:
|
|
@@ -196,13 +199,14 @@ describe("JSON auth token request plugin", function() {
|
|
|
196
199
|
case 1:
|
|
197
200
|
result = _state.sent();
|
|
198
201
|
expect(result.headers.has(authHeaderKey)).toBeTruthy();
|
|
202
|
+
expect((_result_headers_get = result.headers.get(authHeaderKey)) === null || _result_headers_get === void 0 ? void 0 : _result_headers_get.startsWith(authHeaderPrefix)).toBeTruthy();
|
|
199
203
|
return [
|
|
200
204
|
2
|
|
201
205
|
];
|
|
202
206
|
}
|
|
203
207
|
});
|
|
204
208
|
}));
|
|
205
|
-
it(
|
|
209
|
+
it('should check that the jws token is well formatted', /*#__PURE__*/ _async_to_generator(function() {
|
|
206
210
|
var plugin, result, token, tokenParts;
|
|
207
211
|
return _ts_generator(this, function(_state) {
|
|
208
212
|
switch(_state.label){
|
|
@@ -214,8 +218,8 @@ describe("JSON auth token request plugin", function() {
|
|
|
214
218
|
];
|
|
215
219
|
case 1:
|
|
216
220
|
result = _state.sent();
|
|
217
|
-
token = result.headers.get(authHeaderKey);
|
|
218
|
-
tokenParts = token.split(
|
|
221
|
+
token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
|
|
222
|
+
tokenParts = token.split('.');
|
|
219
223
|
expect(token).toBeDefined();
|
|
220
224
|
expect(tokenParts.length).toEqual(3);
|
|
221
225
|
return [
|
|
@@ -224,7 +228,7 @@ describe("JSON auth token request plugin", function() {
|
|
|
224
228
|
}
|
|
225
229
|
});
|
|
226
230
|
}));
|
|
227
|
-
it(
|
|
231
|
+
it('should check that the header is properly set', /*#__PURE__*/ _async_to_generator(function() {
|
|
228
232
|
var base64URLDecoder, plugin, result, token, tokenParts, header;
|
|
229
233
|
return _ts_generator(this, function(_state) {
|
|
230
234
|
switch(_state.label){
|
|
@@ -237,21 +241,21 @@ describe("JSON auth token request plugin", function() {
|
|
|
237
241
|
];
|
|
238
242
|
case 1:
|
|
239
243
|
result = _state.sent();
|
|
240
|
-
token = result.headers.get(authHeaderKey);
|
|
244
|
+
token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
|
|
241
245
|
expect(token).toBeDefined();
|
|
242
|
-
tokenParts = token.split(
|
|
246
|
+
tokenParts = token.split('.');
|
|
243
247
|
header = JSON.parse(base64URLDecoder(tokenParts[0]));
|
|
244
248
|
expect(header.alg).toBeDefined();
|
|
245
|
-
expect(header.alg).toEqual(
|
|
249
|
+
expect(header.alg).toEqual('HS256');
|
|
246
250
|
expect(header.typ).toBeDefined();
|
|
247
|
-
expect(header.typ).toEqual(
|
|
251
|
+
expect(header.typ).toEqual('JWT');
|
|
248
252
|
return [
|
|
249
253
|
2
|
|
250
254
|
];
|
|
251
255
|
}
|
|
252
256
|
});
|
|
253
257
|
}));
|
|
254
|
-
it(
|
|
258
|
+
it('should check that the payload is properly set', /*#__PURE__*/ _async_to_generator(function() {
|
|
255
259
|
var base64URLDecoder, base64Decoder, plugin, result, token, tokenParts, payload, context;
|
|
256
260
|
return _ts_generator(this, function(_state) {
|
|
257
261
|
switch(_state.label){
|
|
@@ -265,9 +269,9 @@ describe("JSON auth token request plugin", function() {
|
|
|
265
269
|
];
|
|
266
270
|
case 1:
|
|
267
271
|
result = _state.sent();
|
|
268
|
-
token = result.headers.get(authHeaderKey);
|
|
272
|
+
token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
|
|
269
273
|
expect(token).toBeDefined();
|
|
270
|
-
tokenParts = token.split(
|
|
274
|
+
tokenParts = token.split('.');
|
|
271
275
|
payload = JSON.parse(base64URLDecoder(tokenParts[1]));
|
|
272
276
|
expect(payload.jti).toBeDefined();
|
|
273
277
|
expect(payload.iat).toBeDefined();
|
|
@@ -284,7 +288,7 @@ describe("JSON auth token request plugin", function() {
|
|
|
284
288
|
}
|
|
285
289
|
});
|
|
286
290
|
}));
|
|
287
|
-
it(
|
|
291
|
+
it('should check the signature validity', /*#__PURE__*/ _async_to_generator(function() {
|
|
288
292
|
var base64URLDecoder, base64UrlEncoder, plugin, result, token, tokenParts, header, payload, signature, secretKey, _, message, signCheck;
|
|
289
293
|
return _ts_generator(this, function(_state) {
|
|
290
294
|
switch(_state.label){
|
|
@@ -298,15 +302,15 @@ describe("JSON auth token request plugin", function() {
|
|
|
298
302
|
];
|
|
299
303
|
case 1:
|
|
300
304
|
result = _state.sent();
|
|
301
|
-
token = result.headers.get(authHeaderKey);
|
|
302
|
-
tokenParts = token.split(
|
|
305
|
+
token = result.headers.get(authHeaderKey).replace(authHeaderPrefix, '');
|
|
306
|
+
tokenParts = token.split('.');
|
|
303
307
|
header = JSON.parse(base64URLDecoder(tokenParts[0]));
|
|
304
308
|
payload = JSON.parse(base64URLDecoder(tokenParts[1]));
|
|
305
309
|
signature = tokenParts[2];
|
|
306
310
|
_ = jsonAuthTokenOptions.apiKey;
|
|
307
311
|
return [
|
|
308
312
|
4,
|
|
309
|
-
(0, _mgwmdwauthrequest.sha256)(jsonAuthTokenOptions.secret + payload.jti + payload.iat
|
|
313
|
+
(0, _mgwmdwauthrequest.sha256)(jsonAuthTokenOptions.secret + payload.jti + payload.iat + routePath)
|
|
310
314
|
];
|
|
311
315
|
case 2:
|
|
312
316
|
return [
|
|
@@ -319,7 +323,7 @@ describe("JSON auth token request plugin", function() {
|
|
|
319
323
|
secretKey = _state.sent();
|
|
320
324
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
321
325
|
message = "".concat(base64UrlEncoder(JSON.stringify(header)), ".").concat(base64UrlEncoder(JSON.stringify(payload)));
|
|
322
|
-
signCheck =
|
|
326
|
+
signCheck = (0, _jsontoken.base64EncodeUrl)((0, _mgwmdwauthrequest.hmacSHA256)(message, secretKey));
|
|
323
327
|
expect(signature).toEqual(signCheck);
|
|
324
328
|
return [
|
|
325
329
|
2
|
|
@@ -187,7 +187,7 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
187
187
|
if (!context.apiClient.options.requestPlugins.some(function(plugin) {
|
|
188
188
|
return _instanceof(plugin, _mockinterceptrequest.MockInterceptRequest);
|
|
189
189
|
})) {
|
|
190
|
-
throw new Error(
|
|
190
|
+
throw new Error('MockInterceptFetch plugin should be used only with the MockInterceptRequest plugin');
|
|
191
191
|
}
|
|
192
192
|
var _this = this;
|
|
193
193
|
return {
|
|
@@ -211,11 +211,11 @@ var MockInterceptFetch = /*#__PURE__*/ function() {
|
|
|
211
211
|
responsePromise
|
|
212
212
|
];
|
|
213
213
|
}
|
|
214
|
-
if (!(typeof _this.options.delayTiming !==
|
|
214
|
+
if (!(typeof _this.options.delayTiming !== 'undefined')) return [
|
|
215
215
|
3,
|
|
216
216
|
6
|
|
217
217
|
];
|
|
218
|
-
if (!(typeof _this.options.delayTiming ===
|
|
218
|
+
if (!(typeof _this.options.delayTiming === 'number')) return [
|
|
219
219
|
3,
|
|
220
220
|
2
|
|
221
221
|
];
|
|
@@ -16,5 +16,5 @@ _export(exports, {
|
|
|
16
16
|
return CUSTOM_MOCK_REQUEST_HEADER;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
var CUSTOM_MOCK_OPERATION_ID_HEADER =
|
|
20
|
-
var CUSTOM_MOCK_REQUEST_HEADER =
|
|
19
|
+
var CUSTOM_MOCK_OPERATION_ID_HEADER = 'X-mock-operation-id';
|
|
20
|
+
var CUSTOM_MOCK_REQUEST_HEADER = 'X-mock-request';
|
|
@@ -241,7 +241,7 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
|
|
|
241
241
|
];
|
|
242
242
|
}
|
|
243
243
|
requestOption = _object_spread_props(_object_spread({}, data), {
|
|
244
|
-
method: data.method ||
|
|
244
|
+
method: data.method || 'GET'
|
|
245
245
|
});
|
|
246
246
|
return [
|
|
247
247
|
4,
|
|
@@ -254,7 +254,7 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
|
|
|
254
254
|
blob = new Blob([
|
|
255
255
|
text
|
|
256
256
|
], {
|
|
257
|
-
type:
|
|
257
|
+
type: 'application/json'
|
|
258
258
|
});
|
|
259
259
|
basePath = URL.createObjectURL(blob);
|
|
260
260
|
headers = data.headers || new Headers();
|
|
@@ -263,7 +263,7 @@ var MockInterceptRequest = /*#__PURE__*/ function() {
|
|
|
263
263
|
return [
|
|
264
264
|
2,
|
|
265
265
|
{
|
|
266
|
-
method:
|
|
266
|
+
method: 'GET',
|
|
267
267
|
basePath: basePath,
|
|
268
268
|
headers: headers
|
|
269
269
|
}
|