UNPKG

@n1k1t/mock-server

Version:

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

19 lines 761 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const models_1 = require("../models"); exports.default = models_1.EndpointFactory .build() .http({ method: 'PUT', path: '/expectations' }) .io({ path: 'expectations:update' }) .compile(async ({ reply, incoming, server }) => { if (!incoming.data) { return reply.validationError(); } const provider = server.providers.extract().find((provider) => provider.storages.expectations.has(incoming.data.id)); if (!provider) { return reply.notFound(); } const updated = await provider.client.updateExpectation(incoming.data); updated ? reply.ok(updated) : reply.notFound(); }); //# sourceMappingURL=expectations.update.endpoint.js.map