request-mocking-protocol
Version:
A protocol for declarative mocking of HTTP requests
35 lines • 1.51 kB
JavaScript
;
/**
* Declarative Mocking Protocol.
*
* This protocol is used to declaratively define mocks, that can be passed over the wire.
* Request schema is used to match the request.
* Response schema is used to generate the response.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildMockSchema = buildMockSchema;
const request_schema_1 = require("./request-schema");
const response_schema_1 = require("./response-schema");
__exportStar(require("./request-schema"), exports);
__exportStar(require("./response-schema"), exports);
function buildMockSchema(reqSchema, resSchema) {
return {
reqSchema: (0, request_schema_1.buildMockRequestSchema)(reqSchema),
resSchema: (0, response_schema_1.buildMockResponseSchema)(resSchema),
};
}
//# sourceMappingURL=index.js.map