mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
11 lines
266 B
TypeScript
11 lines
266 B
TypeScript
import { http, HttpResponse } from 'msw'
|
|
import { setupWorker } from 'msw/browser'
|
|
|
|
const worker = setupWorker(
|
|
http.get<{ code: string }>('/api/:code', ({ params }) => {
|
|
return new HttpResponse(null, { status: parseInt(params.code) })
|
|
}),
|
|
)
|
|
|
|
worker.start()
|