@n1k1t/mock-server
Version:
The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations
34 lines • 902 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Endpoint = exports.EndpointFactory = void 0;
class EndpointFactory {
constructor() {
this.provided = {};
}
http(payload) {
this.provided.http = payload;
return this;
}
io(payload) {
this.provided.io = payload;
return this;
}
compile(handler) {
if (!this.provided.http && !this.provided.io) {
throw new Error('Cannot compile endpoint without locations');
}
return new Endpoint(this.provided, handler);
}
static build() {
return new EndpointFactory();
}
}
exports.EndpointFactory = EndpointFactory;
class Endpoint {
constructor(locations, handler) {
this.locations = locations;
this.handler = handler;
}
}
exports.Endpoint = Endpoint;
//# sourceMappingURL=endpoint.js.map