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.

24 lines (20 loc) 613 B
/** * Generated by Kubb (https://kubb.dev/). * Do not edit manually. */ import { http } from 'msw' export function createPetsResponse201(data?: CreatePetsMutationResponse) { return new Response(JSON.stringify(data), { status: 201, }) } export function createPets( data?: string | number | boolean | null | object | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Response | Promise<Response>), ) { return http.post(`/pets`, function handler(info) { if (typeof data === 'function') return data(info) return new Response(JSON.stringify(data), { status: 201, }) }) }