request-mocking-protocol
Version:
A protocol for declarative mocking of HTTP requests
18 lines • 569 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodMatcher = void 0;
class MethodMatcher {
schema;
constructor(schema) {
this.schema = schema;
}
match(ctx) {
const expectedMethod = this.schema.method;
const actualMethod = ctx.req.method;
const result = !expectedMethod || expectedMethod === actualMethod;
ctx.log(result, `method`, expectedMethod || '*', actualMethod);
return result;
}
}
exports.MethodMatcher = MethodMatcher;
//# sourceMappingURL=method.js.map