Request namespace

Request namespace is an object that simplifies declaration of request handlers.

MSW comes with the following standard request namespaces:

NamespaceDescription
httpNamespace for describing RESTful APIs.
graphqlNamespace 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: