| import { EventEmitter } from 'node:events'; | ||
| export const EVENT_TYPES: { | ||
| BEFORE_REQUEST: 'BEFORE_REQUEST'; | ||
| AFTER_RESPONSE: 'AFTER_RESPONSE'; | ||
| }; | ||
| export const events: EventEmitter; |
| const { EventEmitter } = require('events'); | ||
| const events = new EventEmitter(); | ||
| const EVENT_TYPES = { | ||
| BEFORE_REQUEST: "BEFORE_REQUEST", | ||
| AFTER_RESPONSE: "AFTER_RESPONSE", | ||
| } | ||
| module.exports = { | ||
| events, | ||
| EVENT_TYPES | ||
| } |
+4
-4
| { | ||
| "name": "pactum", | ||
| "version": "3.6.1", | ||
| "version": "3.6.2", | ||
| "description": "REST API Testing Tool for all levels in a Test Pyramid", | ||
@@ -55,3 +55,3 @@ "main": "./src/index.js", | ||
| "dependencies": { | ||
| "@exodus/schemasafe": "^1.2.3", | ||
| "@exodus/schemasafe": "^1.3.0", | ||
| "deep-override": "^1.0.2", | ||
@@ -69,4 +69,4 @@ "form-data-lite": "^1.0.3", | ||
| "devDependencies": { | ||
| "chai": "^4.3.7", | ||
| "mocha": "^10.2.0", | ||
| "chai": "^4.4.1", | ||
| "mocha": "^10.3.0", | ||
| "nyc": "^15.1.0", | ||
@@ -73,0 +73,0 @@ "sinon": "^15.2.0" |
+3
-2
@@ -0,4 +1,4 @@ | ||
| import * as E2E from './models/E2E'; | ||
| import * as Fuzz from './models/Fuzz'; | ||
| import * as Spec from './models/Spec'; | ||
| import * as Fuzz from './models/Fuzz'; | ||
| import * as E2E from './models/E2E'; | ||
@@ -8,2 +8,3 @@ import expect from './exports/expect'; | ||
| export * as events from './exports/events'; | ||
| export * as handler from './exports/handler'; | ||
@@ -10,0 +11,0 @@ export * as mock from './exports/mock'; |
+2
-0
@@ -24,2 +24,3 @@ require('./plugins/logger').setAdapter(require('./adapters/logger')); | ||
| const reporter = require('./exports/reporter'); | ||
| const events = require('./exports/events'); | ||
@@ -45,2 +46,3 @@ const processor = require('./helpers/dataProcessor'); | ||
| reporter, | ||
| events, | ||
@@ -47,0 +49,0 @@ spec(name, data) { |
@@ -13,2 +13,3 @@ const phin = require('phin'); | ||
| const hr = require('../helpers/handler.runner'); | ||
| const { events, EVENT_TYPES } = require('../exports/events'); | ||
@@ -257,2 +258,3 @@ class Tosser { | ||
| try { | ||
| events.emit(EVENT_TYPES.BEFORE_REQUEST, request); | ||
| log.debug(`${request.method} ${request.url}`); | ||
@@ -272,4 +274,6 @@ res = await phin(request); | ||
| res = error; | ||
| } finally { | ||
| res.responseTime = Date.now() - requestStartTime; | ||
| events.emit(EVENT_TYPES.AFTER_RESPONSE, res); | ||
| } | ||
| res.responseTime = Date.now() - requestStartTime; | ||
| return res; | ||
@@ -276,0 +280,0 @@ } |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 10 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 10 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
170200
0.4%63
3.28%5086
0.41%Updated