@mswjs/interceptors 0.19.4 → 0.20.0
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/BatchInterceptor.d.ts +5 -5
- package/lib/BatchInterceptor.js +14 -59
- package/lib/BatchInterceptor.js.map +1 -1
- package/lib/Interceptor.d.ts +7 -6
- package/lib/Interceptor.js +39 -64
- package/lib/Interceptor.js.map +1 -1
- package/lib/RemoteHttpInterceptor.js +115 -209
- package/lib/RemoteHttpInterceptor.js.map +1 -1
- package/lib/glossary.d.ts +2 -2
- package/lib/interceptors/ClientRequest/NodeClientRequest.js +141 -278
- package/lib/interceptors/ClientRequest/NodeClientRequest.js.map +1 -1
- package/lib/interceptors/ClientRequest/http.get.js +5 -34
- package/lib/interceptors/ClientRequest/http.get.js.map +1 -1
- package/lib/interceptors/ClientRequest/http.request.js +6 -35
- package/lib/interceptors/ClientRequest/http.request.js.map +1 -1
- package/lib/interceptors/ClientRequest/index.js +22 -82
- package/lib/interceptors/ClientRequest/index.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/cloneIncomingMessage.js +18 -62
- package/lib/interceptors/ClientRequest/utils/cloneIncomingMessage.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/createRequest.js +10 -32
- package/lib/interceptors/ClientRequest/utils/createRequest.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/createResponse.js +6 -6
- package/lib/interceptors/ClientRequest/utils/createResponse.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/getIncomingMessageBody.js +12 -12
- package/lib/interceptors/ClientRequest/utils/getIncomingMessageBody.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestArgs.js +21 -52
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestArgs.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestEndArgs.js +5 -9
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestEndArgs.js.map +1 -1
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestWriteArgs.js +6 -6
- package/lib/interceptors/ClientRequest/utils/normalizeClientRequestWriteArgs.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestController.d.ts +44 -0
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestController.js +413 -0
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestController.js.map +1 -0
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestProxy.d.ts +20 -0
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestProxy.js +75 -0
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestProxy.js.map +1 -0
- package/lib/interceptors/XMLHttpRequest/index.js +23 -42
- package/lib/interceptors/XMLHttpRequest/index.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.js +11 -12
- package/lib/interceptors/XMLHttpRequest/polyfills/EventPolyfill.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.js +9 -27
- package/lib/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/utils/concatArrayBuffer.js +1 -1
- package/lib/interceptors/XMLHttpRequest/utils/concatArrayBuffer.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/utils/createEvent.js +7 -7
- package/lib/interceptors/XMLHttpRequest/utils/createEvent.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/utils/createResponse.js +2 -2
- package/lib/interceptors/XMLHttpRequest/utils/createResponse.js.map +1 -1
- package/lib/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.js +2 -2
- package/lib/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.js.map +1 -1
- package/lib/interceptors/fetch/index.js +52 -125
- package/lib/interceptors/fetch/index.js.map +1 -1
- package/lib/presets/browser.js +2 -2
- package/lib/presets/browser.js.map +1 -1
- package/lib/presets/node.js +2 -2
- package/lib/presets/node.js.map +1 -1
- package/lib/utils/AsyncEventEmitter.d.ts +9 -8
- package/lib/utils/AsyncEventEmitter.js +84 -190
- package/lib/utils/AsyncEventEmitter.js.map +1 -1
- package/lib/utils/bufferUtils.js +3 -3
- package/lib/utils/bufferUtils.js.map +1 -1
- package/lib/utils/cloneObject.js +2 -19
- package/lib/utils/cloneObject.js.map +1 -1
- package/lib/utils/createLazyCallback.js +14 -49
- package/lib/utils/createLazyCallback.js.map +1 -1
- package/lib/utils/createProxy.d.ts +8 -0
- package/lib/utils/createProxy.js +45 -0
- package/lib/utils/createProxy.js.map +1 -0
- package/lib/utils/getCleanUrl.js +1 -2
- package/lib/utils/getCleanUrl.js.map +1 -1
- package/lib/utils/getRequestOptionsByUrl.js +3 -3
- package/lib/utils/getRequestOptionsByUrl.js.map +1 -1
- package/lib/utils/getUrlByRequestOptions.js +23 -39
- package/lib/utils/getUrlByRequestOptions.js.map +1 -1
- package/lib/utils/nextTick.js +2 -2
- package/lib/utils/nextTick.js.map +1 -1
- package/lib/utils/parseJson.js +1 -1
- package/lib/utils/parseJson.js.map +1 -1
- package/lib/utils/toInteractiveRequest.js +3 -3
- package/lib/utils/toInteractiveRequest.js.map +1 -1
- package/lib/utils/uuid.js +2 -2
- package/lib/utils/uuid.js.map +1 -1
- package/package.json +2 -2
- package/src/BatchInterceptor.test.ts +2 -2
- package/src/BatchInterceptor.ts +14 -13
- package/src/Interceptor.ts +12 -11
- package/src/glossary.ts +2 -6
- package/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts +578 -0
- package/src/interceptors/XMLHttpRequest/XMLHttpRequestProxy.ts +111 -0
- package/src/interceptors/XMLHttpRequest/index.ts +12 -13
- package/src/utils/AsyncEventEmitter.test.ts +6 -6
- package/src/utils/AsyncEventEmitter.ts +60 -50
- package/src/utils/createProxy.ts +78 -0
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestOverride.d.ts +0 -93
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestOverride.js +0 -567
- package/lib/interceptors/XMLHttpRequest/XMLHttpRequestOverride.js.map +0 -1
- package/src/interceptors/XMLHttpRequest/XMLHttpRequestOverride.ts +0 -684
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,123 +8,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
9
|
});
|
|
25
10
|
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
54
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
-
if (!m) return o;
|
|
56
|
-
var i = m.call(o), r, ar = [], e;
|
|
57
|
-
try {
|
|
58
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
-
}
|
|
60
|
-
catch (error) { e = { error: error }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e) throw e.error; }
|
|
66
|
-
}
|
|
67
|
-
return ar;
|
|
68
|
-
};
|
|
69
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
70
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71
|
-
if (ar || !(i in from)) {
|
|
72
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
73
|
-
ar[i] = from[i];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
77
|
-
};
|
|
78
|
-
var __values = (this && this.__values) || function(o) {
|
|
79
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
80
|
-
if (m) return m.call(o);
|
|
81
|
-
if (o && typeof o.length === "number") return {
|
|
82
|
-
next: function () {
|
|
83
|
-
if (o && i >= o.length) o = void 0;
|
|
84
|
-
return { value: o && o[i++], done: !o };
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
88
|
-
};
|
|
89
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90
12
|
exports.NodeClientRequest = void 0;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
requestOptions: requestOptions,
|
|
111
|
-
callback: callback,
|
|
13
|
+
const http_1 = require("http");
|
|
14
|
+
const until_1 = require("@open-draft/until");
|
|
15
|
+
const normalizeClientRequestEndArgs_1 = require("./utils/normalizeClientRequestEndArgs");
|
|
16
|
+
const normalizeClientRequestWriteArgs_1 = require("./utils/normalizeClientRequestWriteArgs");
|
|
17
|
+
const cloneIncomingMessage_1 = require("./utils/cloneIncomingMessage");
|
|
18
|
+
const createResponse_1 = require("./utils/createResponse");
|
|
19
|
+
const createRequest_1 = require("./utils/createRequest");
|
|
20
|
+
const toInteractiveRequest_1 = require("../../utils/toInteractiveRequest");
|
|
21
|
+
const uuid_1 = require("../../utils/uuid");
|
|
22
|
+
class NodeClientRequest extends http_1.ClientRequest {
|
|
23
|
+
constructor([url, requestOptions, callback], options) {
|
|
24
|
+
super(requestOptions, callback);
|
|
25
|
+
this.chunks = [];
|
|
26
|
+
this.responseSource = 'mock';
|
|
27
|
+
this.log = options.log.extend(`request ${requestOptions.method} ${url.href}`);
|
|
28
|
+
this.log('constructing ClientRequest using options:', {
|
|
29
|
+
url,
|
|
30
|
+
requestOptions,
|
|
31
|
+
callback,
|
|
112
32
|
});
|
|
113
|
-
|
|
114
|
-
|
|
33
|
+
this.url = url;
|
|
34
|
+
this.emitter = options.emitter;
|
|
115
35
|
// Set request buffer to null by default so that GET/HEAD requests
|
|
116
36
|
// without a body wouldn't suddenly get one.
|
|
117
|
-
|
|
37
|
+
this.requestBuffer = null;
|
|
118
38
|
// Construct a mocked response message.
|
|
119
|
-
|
|
120
|
-
return _this;
|
|
39
|
+
this.response = new http_1.IncomingMessage(this.socket);
|
|
121
40
|
}
|
|
122
|
-
|
|
41
|
+
writeRequestBodyChunk(chunk, encoding) {
|
|
123
42
|
if (chunk == null) {
|
|
124
43
|
return;
|
|
125
44
|
}
|
|
126
45
|
if (this.requestBuffer == null) {
|
|
127
46
|
this.requestBuffer = Buffer.from([]);
|
|
128
47
|
}
|
|
129
|
-
|
|
48
|
+
const resolvedChunk = Buffer.isBuffer(chunk)
|
|
130
49
|
? chunk
|
|
131
50
|
: Buffer.from(chunk, encoding);
|
|
132
51
|
this.requestBuffer = Buffer.concat([this.requestBuffer, resolvedChunk]);
|
|
133
|
-
}
|
|
134
|
-
|
|
52
|
+
}
|
|
53
|
+
write(...args) {
|
|
135
54
|
var _a;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
var _b = __read((0, normalizeClientRequestWriteArgs_1.normalizeClientRequestWriteArgs)(args), 3), chunk = _b[0], encoding = _b[1], callback = _b[2];
|
|
141
|
-
this.log('write:', { chunk: chunk, encoding: encoding, callback: callback });
|
|
142
|
-
this.chunks.push({ chunk: chunk, encoding: encoding });
|
|
55
|
+
const [chunk, encoding, callback] = (0, normalizeClientRequestWriteArgs_1.normalizeClientRequestWriteArgs)(args);
|
|
56
|
+
this.log('write:', { chunk, encoding, callback });
|
|
57
|
+
this.chunks.push({ chunk, encoding });
|
|
143
58
|
// Write each request body chunk to the internal buffer.
|
|
144
59
|
this.writeRequestBodyChunk(chunk, encoding);
|
|
145
60
|
this.log('chunk successfully stored!', (_a = this.requestBuffer) === null || _a === void 0 ? void 0 : _a.byteLength);
|
|
@@ -157,21 +72,16 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
157
72
|
// the Socket from sending data to a potentially existing
|
|
158
73
|
// server when there is a mocked response defined.
|
|
159
74
|
return true;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
var _this = this;
|
|
163
|
-
var args = [];
|
|
164
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
165
|
-
args[_i] = arguments[_i];
|
|
166
|
-
}
|
|
75
|
+
}
|
|
76
|
+
end(...args) {
|
|
167
77
|
this.log('end', args);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this.log('normalized arguments:', { chunk
|
|
78
|
+
const requestId = (0, uuid_1.uuidv4)();
|
|
79
|
+
const [chunk, encoding, callback] = (0, normalizeClientRequestEndArgs_1.normalizeClientRequestEndArgs)(...args);
|
|
80
|
+
this.log('normalized arguments:', { chunk, encoding, callback });
|
|
171
81
|
// Write the last request body chunk passed to the "end()" method.
|
|
172
82
|
this.writeRequestBodyChunk(chunk, encoding || undefined);
|
|
173
|
-
|
|
174
|
-
|
|
83
|
+
const capturedRequest = (0, createRequest_1.createRequest)(this);
|
|
84
|
+
const interactiveRequest = (0, toInteractiveRequest_1.toInteractiveRequest)(capturedRequest);
|
|
175
85
|
// Prevent handling this request if it has already been handled
|
|
176
86
|
// in another (parent) interceptor (like XMLHttpRequest -> ClientRequest).
|
|
177
87
|
// That means some interceptor up the chain has concluded that
|
|
@@ -186,83 +96,57 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
186
96
|
this.emitter.emit('request', interactiveRequest, requestId);
|
|
187
97
|
// Execute the resolver Promise like a side-effect.
|
|
188
98
|
// Node.js 16 forces "ClientRequest.end" to be synchronous and return "this".
|
|
189
|
-
(0, until_1.until)(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
* of another, unrelated request. For example, during response patching,
|
|
199
|
-
* when request resolution is nested.
|
|
200
|
-
*/
|
|
201
|
-
return pendingRequestId === requestId;
|
|
202
|
-
})];
|
|
203
|
-
case 1:
|
|
204
|
-
_b.sent();
|
|
205
|
-
return [4 /*yield*/, interactiveRequest.respondWith.invoked()];
|
|
206
|
-
case 2:
|
|
207
|
-
_a = __read.apply(void 0, [_b.sent(), 1]), mockedResponse = _a[0];
|
|
208
|
-
this.log('event.respondWith called with:', mockedResponse);
|
|
209
|
-
return [2 /*return*/, mockedResponse];
|
|
210
|
-
}
|
|
99
|
+
(0, until_1.until)(() => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
yield this.emitter.untilIdle('request', ({ args: [, pendingRequestId] }) => {
|
|
101
|
+
/**
|
|
102
|
+
* @note Await only those listeners that are relevant to this request.
|
|
103
|
+
* This prevents extraneous parallel request from blocking the resolution
|
|
104
|
+
* of another, unrelated request. For example, during response patching,
|
|
105
|
+
* when request resolution is nested.
|
|
106
|
+
*/
|
|
107
|
+
return pendingRequestId === requestId;
|
|
211
108
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
109
|
+
const [mockedResponse] = yield interactiveRequest.respondWith.invoked();
|
|
110
|
+
this.log('event.respondWith called with:', mockedResponse);
|
|
111
|
+
return mockedResponse;
|
|
112
|
+
})).then(([resolverException, mockedResponse]) => {
|
|
113
|
+
this.log('the listeners promise awaited!');
|
|
216
114
|
// Halt the request whenever the resolver throws an exception.
|
|
217
115
|
if (resolverException) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return
|
|
116
|
+
this.log('encountered resolver exception, aborting request...', resolverException);
|
|
117
|
+
this.emit('error', resolverException);
|
|
118
|
+
this.terminate();
|
|
119
|
+
return this;
|
|
222
120
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
var _f = __read(_e.value, 2), headerName = _f[0], headerValue = _f[1];
|
|
228
|
-
_this.setHeader(headerName, headerValue);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
232
|
-
finally {
|
|
233
|
-
try {
|
|
234
|
-
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
235
|
-
}
|
|
236
|
-
finally { if (e_1) throw e_1.error; }
|
|
121
|
+
// Forward any request headers that the "request" listener
|
|
122
|
+
// may have modified before proceeding with this request.
|
|
123
|
+
for (const [headerName, headerValue] of capturedRequest.headers) {
|
|
124
|
+
this.setHeader(headerName, headerValue);
|
|
237
125
|
}
|
|
238
126
|
if (mockedResponse) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
127
|
+
const responseClone = mockedResponse.clone();
|
|
128
|
+
this.log('received mocked response:', mockedResponse);
|
|
129
|
+
this.responseSource = 'mock';
|
|
130
|
+
this.respondWith(mockedResponse);
|
|
131
|
+
this.log(mockedResponse.status, mockedResponse.statusText, '(MOCKED)');
|
|
244
132
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return
|
|
133
|
+
this.log('emitting the custom "response" event...');
|
|
134
|
+
this.emitter.emit('response', responseClone, capturedRequest, requestId);
|
|
135
|
+
this.log('request (mock) is completed');
|
|
136
|
+
return this;
|
|
249
137
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
138
|
+
this.log('no mocked response received!');
|
|
139
|
+
this.once('response-internal', (message) => {
|
|
140
|
+
this.log(message.statusCode, message.statusMessage);
|
|
141
|
+
this.log('original response headers:', message.headers);
|
|
142
|
+
this.log('emitting the custom "response" event...');
|
|
143
|
+
this.emitter.emit('response', (0, createResponse_1.createResponse)(message), capturedRequest, requestId);
|
|
256
144
|
});
|
|
257
|
-
return
|
|
145
|
+
return this.passthrough(chunk, encoding, callback);
|
|
258
146
|
});
|
|
259
147
|
return this;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
var data = [];
|
|
263
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
264
|
-
data[_i - 1] = arguments[_i];
|
|
265
|
-
}
|
|
148
|
+
}
|
|
149
|
+
emit(event, ...data) {
|
|
266
150
|
this.log('emit: %s', event);
|
|
267
151
|
if (event === 'response') {
|
|
268
152
|
this.log('found "response" event, cloning the response...');
|
|
@@ -275,21 +159,21 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
275
159
|
* 2. Any external response body listeners.
|
|
276
160
|
* @see https://github.com/mswjs/interceptors/issues/161
|
|
277
161
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
162
|
+
const response = data[0];
|
|
163
|
+
const firstClone = (0, cloneIncomingMessage_1.cloneIncomingMessage)(response);
|
|
164
|
+
const secondClone = (0, cloneIncomingMessage_1.cloneIncomingMessage)(response);
|
|
281
165
|
this.emit('response-internal', secondClone);
|
|
282
166
|
this.log('response successfully cloned, emitting "response" event...');
|
|
283
|
-
return
|
|
167
|
+
return super.emit(event, firstClone, ...data.slice(1));
|
|
284
168
|
}
|
|
285
169
|
catch (error) {
|
|
286
170
|
this.log('error when cloning response:', error);
|
|
287
|
-
return
|
|
171
|
+
return super.emit(event, ...data);
|
|
288
172
|
}
|
|
289
173
|
}
|
|
290
174
|
if (event === 'error') {
|
|
291
|
-
|
|
292
|
-
|
|
175
|
+
const error = data[0];
|
|
176
|
+
const errorCode = error.code || '';
|
|
293
177
|
this.log('error:\n', error);
|
|
294
178
|
// Suppress certain errors while using the "mock" source.
|
|
295
179
|
// For example, no need to destroy this request if it connects
|
|
@@ -305,17 +189,15 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
305
189
|
return false;
|
|
306
190
|
}
|
|
307
191
|
}
|
|
308
|
-
return
|
|
309
|
-
}
|
|
192
|
+
return super.emit(event, ...data);
|
|
193
|
+
}
|
|
310
194
|
/**
|
|
311
195
|
* Performs the intercepted request as-is.
|
|
312
196
|
* Replays the captured request body chunks,
|
|
313
197
|
* still emits the internal events, and wraps
|
|
314
198
|
* up the request with `super.end()`.
|
|
315
199
|
*/
|
|
316
|
-
|
|
317
|
-
var e_2, _a;
|
|
318
|
-
var _this = this;
|
|
200
|
+
passthrough(chunk, encoding, callback) {
|
|
319
201
|
// Set the response source to "bypass".
|
|
320
202
|
// Any errors emitted past this point are not suppressed.
|
|
321
203
|
this.responseSource = 'bypass';
|
|
@@ -326,92 +208,74 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
326
208
|
return this;
|
|
327
209
|
}
|
|
328
210
|
this.log('writing request chunks...', this.chunks);
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (encoding_1) {
|
|
337
|
-
_super.prototype.write.call(this, chunk_1, encoding_1);
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
_super.prototype.write.call(this, chunk_1);
|
|
341
|
-
}
|
|
211
|
+
// Write the request body chunks in the order of ".write()" calls.
|
|
212
|
+
// Note that no request body has been written prior to this point
|
|
213
|
+
// in order to prevent the Socket to communicate with a potentially
|
|
214
|
+
// existing server.
|
|
215
|
+
for (const { chunk, encoding } of this.chunks) {
|
|
216
|
+
if (encoding) {
|
|
217
|
+
super.write(chunk, encoding);
|
|
342
218
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
finally {
|
|
346
|
-
try {
|
|
347
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
219
|
+
else {
|
|
220
|
+
super.write(chunk);
|
|
348
221
|
}
|
|
349
|
-
finally { if (e_2) throw e_2.error; }
|
|
350
222
|
}
|
|
351
|
-
this.once('error',
|
|
352
|
-
|
|
223
|
+
this.once('error', (error) => {
|
|
224
|
+
this.log('original request error:', error);
|
|
353
225
|
});
|
|
354
|
-
this.once('abort',
|
|
355
|
-
|
|
226
|
+
this.once('abort', () => {
|
|
227
|
+
this.log('original request aborted!');
|
|
356
228
|
});
|
|
357
|
-
this.once('response-internal',
|
|
358
|
-
|
|
359
|
-
|
|
229
|
+
this.once('response-internal', (message) => {
|
|
230
|
+
this.log(message.statusCode, message.statusMessage);
|
|
231
|
+
this.log('original response headers:', message.headers);
|
|
360
232
|
});
|
|
361
233
|
this.log('performing original request...');
|
|
362
234
|
// This call signature is way too dynamic.
|
|
363
|
-
return
|
|
364
|
-
}
|
|
235
|
+
return super.end(...[chunk, encoding, callback].filter(Boolean));
|
|
236
|
+
}
|
|
365
237
|
/**
|
|
366
238
|
* Responds to this request instance using a mocked response.
|
|
367
239
|
*/
|
|
368
|
-
|
|
369
|
-
var _this = this;
|
|
240
|
+
respondWith(mockedResponse) {
|
|
370
241
|
this.log('responding with a mocked response...', mockedResponse);
|
|
371
|
-
|
|
242
|
+
const { status, statusText, headers, body } = mockedResponse;
|
|
372
243
|
this.response.statusCode = status;
|
|
373
244
|
this.response.statusMessage = statusText;
|
|
374
245
|
if (headers) {
|
|
375
246
|
this.response.headers = {};
|
|
376
|
-
headers.forEach(
|
|
247
|
+
headers.forEach((headerValue, headerName) => {
|
|
377
248
|
/**
|
|
378
249
|
* @note Make sure that multi-value headers are appended correctly.
|
|
379
250
|
*/
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
251
|
+
this.response.rawHeaders.push(headerName, headerValue);
|
|
252
|
+
const insensitiveHeaderName = headerName.toLowerCase();
|
|
253
|
+
const prevHeaders = this.response.headers[insensitiveHeaderName];
|
|
254
|
+
this.response.headers[insensitiveHeaderName] = prevHeaders
|
|
384
255
|
? Array.prototype.concat([], prevHeaders, headerValue)
|
|
385
256
|
: headerValue;
|
|
386
257
|
});
|
|
387
258
|
}
|
|
388
259
|
this.log('mocked response headers ready:', headers);
|
|
389
|
-
|
|
260
|
+
const closeResponseStream = () => {
|
|
390
261
|
// Push "null" to indicate that the response body is complete
|
|
391
262
|
// and shouldn't be written to anymore.
|
|
392
|
-
|
|
393
|
-
|
|
263
|
+
this.response.push(null);
|
|
264
|
+
this.response.complete = true;
|
|
394
265
|
};
|
|
395
266
|
if (body) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
// this.response.push(Buffer.from(body))
|
|
409
|
-
this.response.push(value);
|
|
410
|
-
return [2 /*return*/, readNextChunk_1()];
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}); };
|
|
414
|
-
readNextChunk_1();
|
|
267
|
+
const bodyReader = body.getReader();
|
|
268
|
+
const readNextChunk = () => __awaiter(this, void 0, void 0, function* () {
|
|
269
|
+
const { done, value } = yield bodyReader.read();
|
|
270
|
+
if (done) {
|
|
271
|
+
closeResponseStream();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
// this.response.push(Buffer.from(body))
|
|
275
|
+
this.response.push(value);
|
|
276
|
+
return readNextChunk();
|
|
277
|
+
});
|
|
278
|
+
readNextChunk();
|
|
415
279
|
}
|
|
416
280
|
else {
|
|
417
281
|
closeResponseStream();
|
|
@@ -431,11 +295,11 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
431
295
|
this.emit('finish');
|
|
432
296
|
this.emit('response', this.response);
|
|
433
297
|
this.terminate();
|
|
434
|
-
}
|
|
298
|
+
}
|
|
435
299
|
/**
|
|
436
300
|
* Terminates a pending request.
|
|
437
301
|
*/
|
|
438
|
-
|
|
302
|
+
terminate() {
|
|
439
303
|
var _a;
|
|
440
304
|
/**
|
|
441
305
|
* @note Some request clients (e.g. Octokit) create a ClientRequest
|
|
@@ -445,18 +309,17 @@ var NodeClientRequest = /** @class */ (function (_super) {
|
|
|
445
309
|
*/
|
|
446
310
|
// @ts-ignore
|
|
447
311
|
(_a = this.agent) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
* The list of internal Node.js errors to suppress while
|
|
451
|
-
* using the "mock" response source.
|
|
452
|
-
*/
|
|
453
|
-
NodeClientRequest.suppressErrorCodes = [
|
|
454
|
-
'ENOTFOUND',
|
|
455
|
-
'ECONNREFUSED',
|
|
456
|
-
'ECONNRESET',
|
|
457
|
-
'EAI_AGAIN',
|
|
458
|
-
];
|
|
459
|
-
return NodeClientRequest;
|
|
460
|
-
}(http_1.ClientRequest));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
461
314
|
exports.NodeClientRequest = NodeClientRequest;
|
|
315
|
+
/**
|
|
316
|
+
* The list of internal Node.js errors to suppress while
|
|
317
|
+
* using the "mock" response source.
|
|
318
|
+
*/
|
|
319
|
+
NodeClientRequest.suppressErrorCodes = [
|
|
320
|
+
'ENOTFOUND',
|
|
321
|
+
'ECONNREFUSED',
|
|
322
|
+
'ECONNRESET',
|
|
323
|
+
'EAI_AGAIN',
|
|
324
|
+
];
|
|
462
325
|
//# sourceMappingURL=NodeClientRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeClientRequest.js","sourceRoot":"","sources":["../../../src/interceptors/ClientRequest/NodeClientRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeClientRequest.js","sourceRoot":"","sources":["../../../src/interceptors/ClientRequest/NodeClientRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+BAAqD;AACrD,6CAAyC;AAEzC,yFAI8C;AAE9C,6FAGgD;AAChD,uEAAmE;AACnE,2DAAuD;AACvD,yDAAqD;AACrD,2EAAuE;AACvE,2CAAyC;AASzC,MAAa,iBAAkB,SAAQ,oBAAa;IAyBlD,YACE,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,CAA8B,EAC5D,OAA0B;QAE1B,KAAK,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;QAdzB,WAAM,GAGT,EAAE,CAAA;QACC,mBAAc,GAAsB,MAAM,CAAA;QAYhD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAC3B,WAAW,cAAc,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAC/C,CAAA;QAED,IAAI,CAAC,GAAG,CAAC,2CAA2C,EAAE;YACpD,GAAG;YACH,cAAc;YACd,QAAQ;SACT,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAE9B,kEAAkE;QAClE,4CAA4C;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;QAEzB,uCAAuC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,sBAAe,CAAC,IAAI,CAAC,MAAO,CAAC,CAAA;IACnD,CAAC;IAEO,qBAAqB,CAC3B,KAA6B,EAC7B,QAAyB;QAEzB,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OA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