@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.
@@ -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, receiver) {
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, receiver) {
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 _chunkXFQ4KKVQjs = require('../../chunk-XFQ4KKVQ.js');
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 = _chunkXFQ4KKVQjs.XMLHttpRequestInterceptor;
9
+ exports.XMLHttpRequestInterceptor = _chunkY4VZR7HZjs.XMLHttpRequestInterceptor;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  XMLHttpRequestInterceptor
3
- } from "../../chunk-QOFKGEDX.mjs";
3
+ } from "../../chunk-NJQK65MD.mjs";
4
4
  import "../../chunk-7II4SWKS.mjs";
5
5
  import "../../chunk-KK6APRON.mjs";
6
6
  import "../../chunk-S72SKXXQ.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXFQ4KKVQjs = require('../chunk-XFQ4KKVQ.js');
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, _chunkXFQ4KKVQjs.XMLHttpRequestInterceptor)()
14
+ new (0, _chunkY4VZR7HZjs.XMLHttpRequestInterceptor)()
15
15
  ];
16
16
 
17
17
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  XMLHttpRequestInterceptor
3
- } from "../chunk-QOFKGEDX.mjs";
3
+ } from "../chunk-NJQK65MD.mjs";
4
4
  import "../chunk-7II4SWKS.mjs";
5
5
  import {
6
6
  FetchInterceptor
@@ -6,7 +6,7 @@ var _chunkAA4NWHDYjs = require('./chunk-AA4NWHDY.js');
6
6
  var _chunkFWLJEVDWjs = require('./chunk-FWLJEVDW.js');
7
7
 
8
8
 
9
- var _chunkMEGFRRJIjs = require('./chunk-MEGFRRJI.js');
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, _chunkMEGFRRJIjs.XMLHttpRequestInterceptor)()
28
+ new (0, _chunkHNNMWWZ6js.XMLHttpRequestInterceptor)()
29
29
  ]
30
30
  });
31
31
  }
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-P4CPJLJS.mjs";
7
7
  import {
8
8
  XMLHttpRequestInterceptor
9
- } from "./chunk-W2OZTHRV.mjs";
9
+ } from "./chunk-JX6GSWVV.mjs";
10
10
  import "./chunk-7II4SWKS.mjs";
11
11
  import "./chunk-3IYIKC3X.mjs";
12
12
  import "./chunk-GFH37L5D.mjs";
@@ -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, receiver) {
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, receiver) {
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 _chunkMEGFRRJIjs = require('../../chunk-MEGFRRJI.js');
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 = _chunkMEGFRRJIjs.XMLHttpRequestInterceptor;
11
+ exports.XMLHttpRequestInterceptor = _chunkHNNMWWZ6js.XMLHttpRequestInterceptor;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  XMLHttpRequestInterceptor
3
- } from "../../chunk-W2OZTHRV.mjs";
3
+ } from "../../chunk-JX6GSWVV.mjs";
4
4
  import "../../chunk-7II4SWKS.mjs";
5
5
  import "../../chunk-3IYIKC3X.mjs";
6
6
  import "../../chunk-GFH37L5D.mjs";
@@ -3,7 +3,7 @@
3
3
  var _chunkFWLJEVDWjs = require('../chunk-FWLJEVDW.js');
4
4
 
5
5
 
6
- var _chunkMEGFRRJIjs = require('../chunk-MEGFRRJI.js');
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, _chunkMEGFRRJIjs.XMLHttpRequestInterceptor)()
16
+ new (0, _chunkHNNMWWZ6js.XMLHttpRequestInterceptor)()
17
17
  ];
18
18
 
19
19
 
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-P4CPJLJS.mjs";
4
4
  import {
5
5
  XMLHttpRequestInterceptor
6
- } from "../chunk-W2OZTHRV.mjs";
6
+ } from "../chunk-JX6GSWVV.mjs";
7
7
  import "../chunk-7II4SWKS.mjs";
8
8
  import "../chunk-3IYIKC3X.mjs";
9
9
  import "../chunk-GFH37L5D.mjs";
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.8",
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": "^0.24.0",
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",
@@ -44,21 +44,21 @@ function optionsToProxyHandler<T extends Record<string, any>>(
44
44
  }
45
45
  }
46
46
 
47
- handler.set = function (target, propertyName, nextValue, receiver) {
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,