UNPKG

@kubb/plugin-msw

Version:

Mock Service Worker (MSW) handlers generator plugin for Kubb, creating API mocks from OpenAPI specifications for frontend development and testing.

28 lines (24 loc) 729 B
/** * Generated by Kubb (https://kubb.dev/). * Do not edit manually. */ import { http } from 'msw' export function showPetByIdResponse200(data: ShowPetByIdQueryResponse) { return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json', }, }) } export function showPetById(data?: ShowPetByIdQueryResponse | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Response | Promise<Response>)) { return http.get(`/pets/:petId`, function handler(info) { if (typeof data === 'function') return data(info) return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json', }, }) }) }