@webex/http-core 2.59.2 → 2.59.3-next.1
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/.eslintrc.js +6 -6
- package/README.md +64 -64
- package/babel.config.js +3 -3
- package/dist/http-error-subtypes.js +57 -57
- package/dist/http-error-subtypes.js.map +1 -1
- package/dist/http-error.js +25 -25
- package/dist/http-error.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interceptors/http-status.js +13 -13
- package/dist/interceptors/http-status.js.map +1 -1
- package/dist/lib/detect.js +6 -6
- package/dist/lib/detect.js.map +1 -1
- package/dist/lib/interceptor.js +34 -34
- package/dist/lib/interceptor.js.map +1 -1
- package/dist/lib/xhr.js +2 -2
- package/dist/lib/xhr.js.map +1 -1
- package/dist/progress-event.js +6 -6
- package/dist/progress-event.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/request/index.js.map +1 -1
- package/dist/request/request.js +14 -14
- package/dist/request/request.js.map +1 -1
- package/dist/request/request.shim.js +65 -65
- package/dist/request/request.shim.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +18 -17
- package/process +1 -1
- package/src/http-error-subtypes.js +187 -187
- package/src/http-error.js +147 -147
- package/src/index.js +58 -58
- package/src/interceptors/http-status.js +63 -63
- package/src/lib/detect.js +33 -33
- package/src/lib/interceptor.js +95 -95
- package/src/lib/xhr.js +258 -258
- package/src/progress-event.js +37 -37
- package/src/request/index.js +62 -62
- package/src/request/request.js +109 -109
- package/src/request/request.shim.js +304 -304
- package/test/integration/spec/http-error.js +188 -188
- package/test/integration/spec/interceptor.js +71 -71
- package/test/integration/spec/progress-event.js +83 -83
- package/test/integration/spec/request.js +310 -310
- package/test/unit/spec/interceptors/http-status.js +49 -49
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {assert} from '@webex/test-helper-chai';
|
|
6
|
-
import {HttpStatusInterceptor} from '@webex/http-core';
|
|
7
|
-
|
|
8
|
-
describe('http-core', () => {
|
|
9
|
-
describe('Interceptors', () => {
|
|
10
|
-
describe('HttpStatusInterceptor', () => {
|
|
11
|
-
let interceptor;
|
|
12
|
-
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
interceptor = Reflect.apply(
|
|
15
|
-
HttpStatusInterceptor.create,
|
|
16
|
-
{
|
|
17
|
-
sessionId: 'mock-webex_uuid',
|
|
18
|
-
},
|
|
19
|
-
[]
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('#onResponse', () => {
|
|
24
|
-
it('resolves on locus redirect error', () => {
|
|
25
|
-
const response = {
|
|
26
|
-
statusCode: 404,
|
|
27
|
-
body: {
|
|
28
|
-
errorCode: 2000002,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return interceptor.onResponse({}, response).then((result) => {
|
|
33
|
-
assert.equal(result, response);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
it('rejects when locus redirect is not intended', () => {
|
|
37
|
-
const response = {
|
|
38
|
-
statusCode: 404,
|
|
39
|
-
body: {
|
|
40
|
-
errorCode: 2000001,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
assert.isRejected(interceptor.onResponse({}, response));
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import {HttpStatusInterceptor} from '@webex/http-core';
|
|
7
|
+
|
|
8
|
+
describe('http-core', () => {
|
|
9
|
+
describe('Interceptors', () => {
|
|
10
|
+
describe('HttpStatusInterceptor', () => {
|
|
11
|
+
let interceptor;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
interceptor = Reflect.apply(
|
|
15
|
+
HttpStatusInterceptor.create,
|
|
16
|
+
{
|
|
17
|
+
sessionId: 'mock-webex_uuid',
|
|
18
|
+
},
|
|
19
|
+
[]
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('#onResponse', () => {
|
|
24
|
+
it('resolves on locus redirect error', () => {
|
|
25
|
+
const response = {
|
|
26
|
+
statusCode: 404,
|
|
27
|
+
body: {
|
|
28
|
+
errorCode: 2000002,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return interceptor.onResponse({}, response).then((result) => {
|
|
33
|
+
assert.equal(result, response);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
it('rejects when locus redirect is not intended', () => {
|
|
37
|
+
const response = {
|
|
38
|
+
statusCode: 404,
|
|
39
|
+
body: {
|
|
40
|
+
errorCode: 2000001,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
assert.isRejected(interceptor.onResponse({}, response));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|