- Introduction
- Getting started
- Philosophy
- Comparison
- Limitations
- Debugging runbook
- FAQ
- Basics
- Concepts
- Network behavior
- Integrations
- API
- CLI
- Best practices
- Recipes
- Cookies
- Query parameters
- Response patching
- Polling
- Streaming
- Network errors
- File uploads
- Responding with binary
- Custom worker script location
- Global response delay
- GraphQL query batching
- Higher-order resolver
- Keeping mocks in sync
- Merging Service Workers
- Mock GraphQL schema
- Using CDN
- Using custom "homepage" property
- Using local HTTPS
Request namespace
Please consider disabling AdBlocker for this site. Thank you for supporting the project.
Request namespace is an object that simplifies declaration of request handlers.
MSW comes with the following standard request namespaces:
Namespace | Description |
---|---|
http | Namespace for describing RESTful APIs. |
graphql | Namespace for describing GraphQL APIs. |
All namespaces can be imported from the msw
package and used within the same network description.
// handlers.js
import { http, graphql } from 'msw'
export const handlers = [
http.get('/user/:id', resolver),
graphql.mutation('SignIn', resolver),
]
Standard namespaces
Learn more about the standard namespaces by following these links: