mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
18 lines
275 B
TypeScript
18 lines
275 B
TypeScript
import { http, HttpResponse } from 'msw'
|
|
import { setupWorker } from 'msw/browser'
|
|
|
|
let callCount = 0
|
|
|
|
const worker = setupWorker(
|
|
http.get('/resource', () => {
|
|
callCount++
|
|
return HttpResponse.json({ callCount })
|
|
}),
|
|
)
|
|
|
|
worker.start()
|
|
|
|
window.msw = {
|
|
worker,
|
|
}
|