UNPKG

@n1k1t/mock-server

Version:

The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations

24 lines 994 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SystemSocketIoReply = void 0; const utils_1 = require("../utils"); const models_1 = require("../../../models"); class SystemSocketIoReply extends models_1.Reply { ok(payload) { this.context.request.callback?.((0, utils_1.buildEndpointResponse)('OK', payload)); } internalError(message = 'Something went wrong') { this.context.request.callback?.((0, utils_1.buildEndpointResponse)('INTERNAL_ERROR', { message })); } validationError(reasons = ['Payload is not valid']) { this.context.request.callback?.((0, utils_1.buildEndpointResponse)('VALIDATION_ERROR', { reasons })); } notFound() { this.context.request.callback?.((0, utils_1.buildEndpointResponse)('NOT_FOUND', null)); } static build(context) { return new SystemSocketIoReply(context); } } exports.SystemSocketIoReply = SystemSocketIoReply; //# sourceMappingURL=reply.js.map