mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
21 lines
345 B
TypeScript
21 lines
345 B
TypeScript
import { http, HttpResponse } from 'msw'
|
|
import { setupWorker } from 'msw/browser'
|
|
|
|
const worker = setupWorker(
|
|
http.get('/book/:bookId', function originalResolver() {
|
|
return HttpResponse.json({
|
|
title: 'Original title',
|
|
})
|
|
}),
|
|
)
|
|
|
|
worker.start()
|
|
|
|
Object.assign(window, {
|
|
msw: {
|
|
worker,
|
|
http,
|
|
HttpResponse,
|
|
},
|
|
})
|