request-mocking-protocol
Version:
A protocol for declarative mocking of HTTP requests
15 lines • 575 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchSchemas = matchSchemas;
const _1 = require(".");
async function matchSchemas(req, mockSchemas = []) {
for (const mockSchema of mockSchemas) {
const debug = mockSchema.reqSchema.debug || mockSchema.resSchema.debug;
const matcher = new _1.RequestMatcher(mockSchema.reqSchema, debug);
const result = await matcher.match(req);
if (result) {
return { mockSchema, req: req, params: result };
}
}
}
//# sourceMappingURL=utils.js.map