mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
Co-authored-by: Frederik Rabøl <[email protected]> Co-authored-by: Christoph Fricke <[email protected]> Co-authored-by: Piotr <[email protected]> Co-authored-by: Kristján Oddsson <[email protected]> Co-authored-by: thepassle <[email protected]> Co-authored-by: Kevin Østerkilde <[email protected]> Co-authored-by: Laryssa Rocha <[email protected]> Co-authored-by: Matthew Costabile <[email protected]>
17 lines
547 B
TypeScript
17 lines
547 B
TypeScript
import { http, HttpResponse } from 'msw'
|
|
import { setupWorker } from 'msw/browser'
|
|
|
|
const worker = setupWorker(
|
|
// WARNING: Intentionally invalid example of including a query parameter
|
|
// in the request handler URL. Don't do that, consider matching against a path
|
|
// and accessing query parameters in the response resolver instead.
|
|
http.get('/user?name=admin', () => {
|
|
return HttpResponse.text('user-response')
|
|
}),
|
|
http.post('/login?id=123&type=auth', () => {
|
|
return HttpResponse.text('login-response')
|
|
}),
|
|
)
|
|
|
|
worker.start()
|