@kubb/plugin-msw
Version:
Mock Service Worker (MSW) handlers generator plugin for Kubb, creating API mocks from OpenAPI specifications for frontend development and testing.
16 lines (13 loc) • 427 B
text/typescript
/**
* Generated by Kubb (https://kubb.dev/).
* Do not edit manually.
*/
import { http } from 'msw'
export function createPets(data?: CreatePetsMutationResponse | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Response)) {
return http.post('/pets', function handler(info) {
if (typeof data === 'function') return data(info)
return new Response(JSON.stringify(data), {
status: 201,
})
})
}