@mswjs/interceptors 0.25.8 → 0.25.9
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/lib/browser/{chunk-QOFKGEDX.mjs → chunk-NJQK65MD.mjs} +2 -4
- package/lib/browser/{chunk-XFQ4KKVQ.js → chunk-Y4VZR7HZ.js} +2 -4
- package/lib/browser/interceptors/XMLHttpRequest/index.js +2 -2
- package/lib/browser/interceptors/XMLHttpRequest/index.mjs +1 -1
- package/lib/browser/presets/browser.js +2 -2
- package/lib/browser/presets/browser.mjs +1 -1
- package/lib/node/RemoteHttpInterceptor.js +2 -2
- package/lib/node/RemoteHttpInterceptor.mjs +1 -1
- package/lib/node/{chunk-MEGFRRJI.js → chunk-HNNMWWZ6.js} +2 -4
- package/lib/node/{chunk-W2OZTHRV.mjs → chunk-JX6GSWVV.mjs} +2 -4
- package/lib/node/interceptors/XMLHttpRequest/index.js +2 -2
- package/lib/node/interceptors/XMLHttpRequest/index.mjs +1 -1
- package/lib/node/presets/node.js +2 -2
- package/lib/node/presets/node.mjs +1 -1
- package/package.json +3 -2
- package/src/utils/createProxy.ts +4 -4
|
@@ -136,11 +136,9 @@ function optionsToProxyHandler(options) {
|
|
|
136
136
|
return constructorCall.call(newTarget, args, next);
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
handler.set = function(target, propertyName, nextValue
|
|
139
|
+
handler.set = function(target, propertyName, nextValue) {
|
|
140
140
|
const next = () => {
|
|
141
|
-
const propertySource = findPropertySource(target, propertyName);
|
|
142
|
-
if (propertySource === null)
|
|
143
|
-
return false;
|
|
141
|
+
const propertySource = findPropertySource(target, propertyName) || target;
|
|
144
142
|
const ownDescriptors = Reflect.getOwnPropertyDescriptor(
|
|
145
143
|
propertySource,
|
|
146
144
|
propertyName
|
|
@@ -136,11 +136,9 @@ function optionsToProxyHandler(options) {
|
|
|
136
136
|
return constructorCall.call(newTarget, args, next);
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
handler.set = function(target, propertyName, nextValue
|
|
139
|
+
handler.set = function(target, propertyName, nextValue) {
|
|
140
140
|
const next = () => {
|
|
141
|
-
const propertySource = findPropertySource(target, propertyName);
|
|
142
|
-
if (propertySource === null)
|
|
143
|
-
return false;
|
|
141
|
+
const propertySource = findPropertySource(target, propertyName) || target;
|
|
144
142
|
const ownDescriptors = Reflect.getOwnPropertyDescriptor(
|
|
145
143
|
propertySource,
|
|
146
144
|
propertyName
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkY4VZR7HZjs = require('../../chunk-Y4VZR7HZ.js');
|
|
4
4
|
require('../../chunk-3LFH2WCF.js');
|
|
5
5
|
require('../../chunk-X3NRJIZW.js');
|
|
6
6
|
require('../../chunk-G5ORGOKH.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.XMLHttpRequestInterceptor =
|
|
9
|
+
exports.XMLHttpRequestInterceptor = _chunkY4VZR7HZjs.XMLHttpRequestInterceptor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkY4VZR7HZjs = require('../chunk-Y4VZR7HZ.js');
|
|
4
4
|
require('../chunk-3LFH2WCF.js');
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ require('../chunk-G5ORGOKH.js');
|
|
|
11
11
|
// src/presets/browser.ts
|
|
12
12
|
var browser_default = [
|
|
13
13
|
new (0, _chunkECJJD4T6js.FetchInterceptor)(),
|
|
14
|
-
new (0,
|
|
14
|
+
new (0, _chunkY4VZR7HZjs.XMLHttpRequestInterceptor)()
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
|
|
@@ -6,7 +6,7 @@ var _chunkAA4NWHDYjs = require('./chunk-AA4NWHDY.js');
|
|
|
6
6
|
var _chunkFWLJEVDWjs = require('./chunk-FWLJEVDW.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkHNNMWWZ6js = require('./chunk-HNNMWWZ6.js');
|
|
10
10
|
require('./chunk-3LFH2WCF.js');
|
|
11
11
|
require('./chunk-OGN3ZR35.js');
|
|
12
12
|
require('./chunk-VQ4DZOBB.js');
|
|
@@ -25,7 +25,7 @@ var RemoteHttpInterceptor = class extends _chunkAA4NWHDYjs.BatchInterceptor {
|
|
|
25
25
|
name: "remote-interceptor",
|
|
26
26
|
interceptors: [
|
|
27
27
|
new (0, _chunkFWLJEVDWjs.ClientRequestInterceptor)(),
|
|
28
|
-
new (0,
|
|
28
|
+
new (0, _chunkHNNMWWZ6js.XMLHttpRequestInterceptor)()
|
|
29
29
|
]
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -141,11 +141,9 @@ function optionsToProxyHandler(options) {
|
|
|
141
141
|
return constructorCall.call(newTarget, args, next);
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
handler.set = function(target, propertyName, nextValue
|
|
144
|
+
handler.set = function(target, propertyName, nextValue) {
|
|
145
145
|
const next = () => {
|
|
146
|
-
const propertySource = findPropertySource(target, propertyName);
|
|
147
|
-
if (propertySource === null)
|
|
148
|
-
return false;
|
|
146
|
+
const propertySource = findPropertySource(target, propertyName) || target;
|
|
149
147
|
const ownDescriptors = Reflect.getOwnPropertyDescriptor(
|
|
150
148
|
propertySource,
|
|
151
149
|
propertyName
|
|
@@ -141,11 +141,9 @@ function optionsToProxyHandler(options) {
|
|
|
141
141
|
return constructorCall.call(newTarget, args, next);
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
handler.set = function(target, propertyName, nextValue
|
|
144
|
+
handler.set = function(target, propertyName, nextValue) {
|
|
145
145
|
const next = () => {
|
|
146
|
-
const propertySource = findPropertySource(target, propertyName);
|
|
147
|
-
if (propertySource === null)
|
|
148
|
-
return false;
|
|
146
|
+
const propertySource = findPropertySource(target, propertyName) || target;
|
|
149
147
|
const ownDescriptors = Reflect.getOwnPropertyDescriptor(
|
|
150
148
|
propertySource,
|
|
151
149
|
propertyName
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHNNMWWZ6js = require('../../chunk-HNNMWWZ6.js');
|
|
4
4
|
require('../../chunk-3LFH2WCF.js');
|
|
5
5
|
require('../../chunk-OGN3ZR35.js');
|
|
6
6
|
require('../../chunk-VQ4DZOBB.js');
|
|
@@ -8,4 +8,4 @@ require('../../chunk-5PTPJLB7.js');
|
|
|
8
8
|
require('../../chunk-UZM2Y7WJ.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.XMLHttpRequestInterceptor =
|
|
11
|
+
exports.XMLHttpRequestInterceptor = _chunkHNNMWWZ6js.XMLHttpRequestInterceptor;
|
package/lib/node/presets/node.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkFWLJEVDWjs = require('../chunk-FWLJEVDW.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkHNNMWWZ6js = require('../chunk-HNNMWWZ6.js');
|
|
7
7
|
require('../chunk-3LFH2WCF.js');
|
|
8
8
|
require('../chunk-OGN3ZR35.js');
|
|
9
9
|
require('../chunk-VQ4DZOBB.js');
|
|
@@ -13,7 +13,7 @@ require('../chunk-UZM2Y7WJ.js');
|
|
|
13
13
|
// src/presets/node.ts
|
|
14
14
|
var node_default = [
|
|
15
15
|
new (0, _chunkFWLJEVDWjs.ClientRequestInterceptor)(),
|
|
16
|
-
new (0,
|
|
16
|
+
new (0, _chunkHNNMWWZ6js.XMLHttpRequestInterceptor)()
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mswjs/interceptors",
|
|
3
3
|
"description": "Low-level HTTP/HTTPS/XHR/fetch request interception library.",
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.9",
|
|
5
5
|
"main": "./lib/node/index.js",
|
|
6
6
|
"module": "./lib/node/index.mjs",
|
|
7
7
|
"types": "./lib/node/index.d.ts",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@types/node": "^16.11.26",
|
|
99
99
|
"@types/node-fetch": "2.5.12",
|
|
100
100
|
"@types/supertest": "^2.0.11",
|
|
101
|
-
"axios": "^
|
|
101
|
+
"axios": "^1.6.0",
|
|
102
102
|
"body-parser": "^1.19.0",
|
|
103
103
|
"commitizen": "^4.2.4",
|
|
104
104
|
"cors": "^2.8.5",
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
"express-rate-limit": "^6.3.0",
|
|
109
109
|
"follow-redirects": "^1.15.1",
|
|
110
110
|
"got": "^11.8.3",
|
|
111
|
+
"happy-dom": "^12.10.3",
|
|
111
112
|
"jest": "^27.4.3",
|
|
112
113
|
"node-fetch": "2.6.7",
|
|
113
114
|
"rimraf": "^3.0.2",
|
package/src/utils/createProxy.ts
CHANGED
|
@@ -44,21 +44,21 @@ function optionsToProxyHandler<T extends Record<string, any>>(
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
handler.set = function (target, propertyName, nextValue
|
|
47
|
+
handler.set = function (target, propertyName, nextValue) {
|
|
48
48
|
const next = () => {
|
|
49
|
-
const propertySource = findPropertySource(target, propertyName)
|
|
50
|
-
if (propertySource === null) return false
|
|
51
|
-
|
|
49
|
+
const propertySource = findPropertySource(target, propertyName) || target
|
|
52
50
|
const ownDescriptors = Reflect.getOwnPropertyDescriptor(
|
|
53
51
|
propertySource,
|
|
54
52
|
propertyName
|
|
55
53
|
)
|
|
56
54
|
|
|
55
|
+
// Respect any custom setters present for this property.
|
|
57
56
|
if (typeof ownDescriptors?.set !== 'undefined') {
|
|
58
57
|
ownDescriptors.set.apply(target, [nextValue])
|
|
59
58
|
return true
|
|
60
59
|
}
|
|
61
60
|
|
|
61
|
+
// Otherwise, set the property on the source.
|
|
62
62
|
return Reflect.defineProperty(propertySource, propertyName, {
|
|
63
63
|
writable: true,
|
|
64
64
|
enumerable: true,
|