test-proxy-recorder 0.1.7 → 0.1.8
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/dist/index.cjs +2 -14
- package/dist/index.mjs +2 -14
- package/dist/proxy.js +2 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -293,7 +293,6 @@ var ProxyServer = class {
|
|
|
293
293
|
}
|
|
294
294
|
async saveCurrentSession(filterIncomplete = false) {
|
|
295
295
|
if (!this.currentSession) {
|
|
296
|
-
console.log("No current session to save");
|
|
297
296
|
return;
|
|
298
297
|
}
|
|
299
298
|
if (filterIncomplete) {
|
|
@@ -301,9 +300,6 @@ var ProxyServer = class {
|
|
|
301
300
|
(r) => !r.response
|
|
302
301
|
).length;
|
|
303
302
|
if (incompleteCount > 0) {
|
|
304
|
-
console.log(
|
|
305
|
-
`Removing ${incompleteCount} incomplete recording(s) without responses`
|
|
306
|
-
);
|
|
307
303
|
this.currentSession.recordings = this.currentSession.recordings.filter(
|
|
308
304
|
(r) => r.response
|
|
309
305
|
);
|
|
@@ -316,7 +312,6 @@ var ProxyServer = class {
|
|
|
316
312
|
}
|
|
317
313
|
saveRequestRecordSync(req, body) {
|
|
318
314
|
if (!this.currentSession) {
|
|
319
|
-
console.log("saveRequestRecordSync: No current session");
|
|
320
315
|
return;
|
|
321
316
|
}
|
|
322
317
|
const key = getReqID(req);
|
|
@@ -340,7 +335,6 @@ var ProxyServer = class {
|
|
|
340
335
|
}
|
|
341
336
|
updateRequestBodySync(req, body) {
|
|
342
337
|
if (!this.currentSession) {
|
|
343
|
-
console.log("updateRequestBodySync: No current session");
|
|
344
338
|
return;
|
|
345
339
|
}
|
|
346
340
|
const key = getReqID(req);
|
|
@@ -386,7 +380,6 @@ var ProxyServer = class {
|
|
|
386
380
|
}
|
|
387
381
|
async recordResponseData(req, proxyRes, body) {
|
|
388
382
|
if (!this.currentSession) {
|
|
389
|
-
console.log("recordResponseData: No current session");
|
|
390
383
|
return false;
|
|
391
384
|
}
|
|
392
385
|
const key = getReqID(req);
|
|
@@ -440,13 +433,8 @@ var ProxyServer = class {
|
|
|
440
433
|
);
|
|
441
434
|
}
|
|
442
435
|
const usageCount = this.replaySequenceMap.get(key) || 0;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
record = recordsWithKey[recordsWithKey.length - 1];
|
|
446
|
-
} else {
|
|
447
|
-
const recordIndex = usageCount % recordsWithKey.length;
|
|
448
|
-
record = recordsWithKey[recordIndex];
|
|
449
|
-
}
|
|
436
|
+
const recordIndex = usageCount % recordsWithKey.length;
|
|
437
|
+
const record = recordsWithKey[recordIndex];
|
|
450
438
|
console.log(
|
|
451
439
|
`Replaying ${req.method} ${req.url} (usage: ${usageCount}, sequence: ${record.sequence}, body_len: ${record.response?.body?.length || 0})`
|
|
452
440
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -282,7 +282,6 @@ var ProxyServer = class {
|
|
|
282
282
|
}
|
|
283
283
|
async saveCurrentSession(filterIncomplete = false) {
|
|
284
284
|
if (!this.currentSession) {
|
|
285
|
-
console.log("No current session to save");
|
|
286
285
|
return;
|
|
287
286
|
}
|
|
288
287
|
if (filterIncomplete) {
|
|
@@ -290,9 +289,6 @@ var ProxyServer = class {
|
|
|
290
289
|
(r) => !r.response
|
|
291
290
|
).length;
|
|
292
291
|
if (incompleteCount > 0) {
|
|
293
|
-
console.log(
|
|
294
|
-
`Removing ${incompleteCount} incomplete recording(s) without responses`
|
|
295
|
-
);
|
|
296
292
|
this.currentSession.recordings = this.currentSession.recordings.filter(
|
|
297
293
|
(r) => r.response
|
|
298
294
|
);
|
|
@@ -305,7 +301,6 @@ var ProxyServer = class {
|
|
|
305
301
|
}
|
|
306
302
|
saveRequestRecordSync(req, body) {
|
|
307
303
|
if (!this.currentSession) {
|
|
308
|
-
console.log("saveRequestRecordSync: No current session");
|
|
309
304
|
return;
|
|
310
305
|
}
|
|
311
306
|
const key = getReqID(req);
|
|
@@ -329,7 +324,6 @@ var ProxyServer = class {
|
|
|
329
324
|
}
|
|
330
325
|
updateRequestBodySync(req, body) {
|
|
331
326
|
if (!this.currentSession) {
|
|
332
|
-
console.log("updateRequestBodySync: No current session");
|
|
333
327
|
return;
|
|
334
328
|
}
|
|
335
329
|
const key = getReqID(req);
|
|
@@ -375,7 +369,6 @@ var ProxyServer = class {
|
|
|
375
369
|
}
|
|
376
370
|
async recordResponseData(req, proxyRes, body) {
|
|
377
371
|
if (!this.currentSession) {
|
|
378
|
-
console.log("recordResponseData: No current session");
|
|
379
372
|
return false;
|
|
380
373
|
}
|
|
381
374
|
const key = getReqID(req);
|
|
@@ -429,13 +422,8 @@ var ProxyServer = class {
|
|
|
429
422
|
);
|
|
430
423
|
}
|
|
431
424
|
const usageCount = this.replaySequenceMap.get(key) || 0;
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
record = recordsWithKey[recordsWithKey.length - 1];
|
|
435
|
-
} else {
|
|
436
|
-
const recordIndex = usageCount % recordsWithKey.length;
|
|
437
|
-
record = recordsWithKey[recordIndex];
|
|
438
|
-
}
|
|
425
|
+
const recordIndex = usageCount % recordsWithKey.length;
|
|
426
|
+
const record = recordsWithKey[recordIndex];
|
|
439
427
|
console.log(
|
|
440
428
|
`Replaying ${req.method} ${req.url} (usage: ${usageCount}, sequence: ${record.sequence}, body_len: ${record.response?.body?.length || 0})`
|
|
441
429
|
);
|
package/dist/proxy.js
CHANGED
|
@@ -316,7 +316,6 @@ var ProxyServer = class {
|
|
|
316
316
|
}
|
|
317
317
|
async saveCurrentSession(filterIncomplete = false) {
|
|
318
318
|
if (!this.currentSession) {
|
|
319
|
-
console.log("No current session to save");
|
|
320
319
|
return;
|
|
321
320
|
}
|
|
322
321
|
if (filterIncomplete) {
|
|
@@ -324,9 +323,6 @@ var ProxyServer = class {
|
|
|
324
323
|
(r) => !r.response
|
|
325
324
|
).length;
|
|
326
325
|
if (incompleteCount > 0) {
|
|
327
|
-
console.log(
|
|
328
|
-
`Removing ${incompleteCount} incomplete recording(s) without responses`
|
|
329
|
-
);
|
|
330
326
|
this.currentSession.recordings = this.currentSession.recordings.filter(
|
|
331
327
|
(r) => r.response
|
|
332
328
|
);
|
|
@@ -339,7 +335,6 @@ var ProxyServer = class {
|
|
|
339
335
|
}
|
|
340
336
|
saveRequestRecordSync(req, body) {
|
|
341
337
|
if (!this.currentSession) {
|
|
342
|
-
console.log("saveRequestRecordSync: No current session");
|
|
343
338
|
return;
|
|
344
339
|
}
|
|
345
340
|
const key = getReqID(req);
|
|
@@ -363,7 +358,6 @@ var ProxyServer = class {
|
|
|
363
358
|
}
|
|
364
359
|
updateRequestBodySync(req, body) {
|
|
365
360
|
if (!this.currentSession) {
|
|
366
|
-
console.log("updateRequestBodySync: No current session");
|
|
367
361
|
return;
|
|
368
362
|
}
|
|
369
363
|
const key = getReqID(req);
|
|
@@ -409,7 +403,6 @@ var ProxyServer = class {
|
|
|
409
403
|
}
|
|
410
404
|
async recordResponseData(req, proxyRes, body) {
|
|
411
405
|
if (!this.currentSession) {
|
|
412
|
-
console.log("recordResponseData: No current session");
|
|
413
406
|
return false;
|
|
414
407
|
}
|
|
415
408
|
const key = getReqID(req);
|
|
@@ -463,13 +456,8 @@ var ProxyServer = class {
|
|
|
463
456
|
);
|
|
464
457
|
}
|
|
465
458
|
const usageCount = this.replaySequenceMap.get(key) || 0;
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
record = recordsWithKey[recordsWithKey.length - 1];
|
|
469
|
-
} else {
|
|
470
|
-
const recordIndex = usageCount % recordsWithKey.length;
|
|
471
|
-
record = recordsWithKey[recordIndex];
|
|
472
|
-
}
|
|
459
|
+
const recordIndex = usageCount % recordsWithKey.length;
|
|
460
|
+
const record = recordsWithKey[recordIndex];
|
|
473
461
|
console.log(
|
|
474
462
|
`Replaying ${req.method} ${req.url} (usage: ${usageCount}, sequence: ${record.sequence}, body_len: ${record.response?.body?.length || 0})`
|
|
475
463
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-proxy-recorder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "HTTP proxy server for recording and replaying network requests in testing. Works seamlessly with Playwright testing framework.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|