@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,83 +1,83 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {assert} from '@webex/test-helper-chai';
|
|
6
|
-
import {ProgressEvent} from '@webex/http-core';
|
|
7
|
-
|
|
8
|
-
describe('http-core', () => {
|
|
9
|
-
describe('ProgressEvent', () => {
|
|
10
|
-
let event;
|
|
11
|
-
|
|
12
|
-
const loaded = 100;
|
|
13
|
-
const total = 500;
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
event = new ProgressEvent(loaded, total);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('#loaded', () => {
|
|
20
|
-
it('exists', () => {
|
|
21
|
-
assert.property(event, 'loaded');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('matches the value passed to the constructor', () => {
|
|
25
|
-
assert.equal(event.loaded, loaded);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('#total', () => {
|
|
30
|
-
it('exists', () => {
|
|
31
|
-
assert.property(event, 'total');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('matches the value passed to the constructor', () => {
|
|
35
|
-
assert.equal(event.total, total);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('#lengthComputable', () => {
|
|
40
|
-
it('exists', () => {
|
|
41
|
-
assert.property(event, 'lengthComputable');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('indicates that request progress can be computed', () => {
|
|
45
|
-
assert.isTrue(event.lengthComputable);
|
|
46
|
-
[
|
|
47
|
-
{
|
|
48
|
-
loaded: undefined,
|
|
49
|
-
total: undefined,
|
|
50
|
-
result: false,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
loaded: 10,
|
|
54
|
-
total: undefined,
|
|
55
|
-
result: false,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
loaded: undefined,
|
|
59
|
-
total: 10,
|
|
60
|
-
result: false,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
loaded: 10,
|
|
64
|
-
total: 10,
|
|
65
|
-
result: true,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
loaded: 10,
|
|
69
|
-
total: 0,
|
|
70
|
-
result: false,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
loaded: 0,
|
|
74
|
-
total: 0,
|
|
75
|
-
result: false,
|
|
76
|
-
},
|
|
77
|
-
].forEach((item) => {
|
|
78
|
-
assert.equal(new ProgressEvent(item.loaded, item.total).lengthComputable, item.result);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import {ProgressEvent} from '@webex/http-core';
|
|
7
|
+
|
|
8
|
+
describe('http-core', () => {
|
|
9
|
+
describe('ProgressEvent', () => {
|
|
10
|
+
let event;
|
|
11
|
+
|
|
12
|
+
const loaded = 100;
|
|
13
|
+
const total = 500;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
event = new ProgressEvent(loaded, total);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('#loaded', () => {
|
|
20
|
+
it('exists', () => {
|
|
21
|
+
assert.property(event, 'loaded');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('matches the value passed to the constructor', () => {
|
|
25
|
+
assert.equal(event.loaded, loaded);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('#total', () => {
|
|
30
|
+
it('exists', () => {
|
|
31
|
+
assert.property(event, 'total');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('matches the value passed to the constructor', () => {
|
|
35
|
+
assert.equal(event.total, total);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('#lengthComputable', () => {
|
|
40
|
+
it('exists', () => {
|
|
41
|
+
assert.property(event, 'lengthComputable');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('indicates that request progress can be computed', () => {
|
|
45
|
+
assert.isTrue(event.lengthComputable);
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
loaded: undefined,
|
|
49
|
+
total: undefined,
|
|
50
|
+
result: false,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
loaded: 10,
|
|
54
|
+
total: undefined,
|
|
55
|
+
result: false,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
loaded: undefined,
|
|
59
|
+
total: 10,
|
|
60
|
+
result: false,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
loaded: 10,
|
|
64
|
+
total: 10,
|
|
65
|
+
result: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
loaded: 10,
|
|
69
|
+
total: 0,
|
|
70
|
+
result: false,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
loaded: 0,
|
|
74
|
+
total: 0,
|
|
75
|
+
result: false,
|
|
76
|
+
},
|
|
77
|
+
].forEach((item) => {
|
|
78
|
+
assert.equal(new ProgressEvent(item.loaded, item.total).lengthComputable, item.result);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|