Skip to main content

Built and signed on GitHub Actions

Some extra utilities to write MSW GraphQL and rest handlers.

This package works with Node.js, BrowsersIt is unknown whether this package works with Cloudflare Workers, Deno, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
76%
Published
3 months ago (0.0.35)
type alias RestHandlersFactory

Properties

post: <
TSearchParams extends Record<string, string>,
THeaders extends Record<string, string>,
RequestBodyType extends DefaultBodyType = DefaultBodyType,
Params extends PathParams<keyof Params> = PathParams,
ResponseBody extends DefaultBodyType = DefaultBodyType,
>
(
path: string,
matchers: WithBodyMatcherOptions<TSearchParams, THeaders, RequestBodyType>,
response: (info: ResponseResolverInfo<HttpRequestResolverExtras<Params>, RequestBodyType>) => ResponseResolverReturnType<ResponseBody> | Promise<ResponseResolverReturnType<ResponseBody>>,
options?: HandlerOptions,
) => HttpHandler
get: <
TSearchParams extends Record<string, string>,
THeaders extends Record<string, string>,
Params extends PathParams<keyof Params> = PathParams,
ResponseBody extends DefaultBodyType = DefaultBodyType,
>
(
path: string,
matchers: MatcherOptions<TSearchParams, THeaders>,
response: ResponseResolver<HttpRequestResolverExtras<Params>, never, ResponseBody>,
options?: HandlerOptions,
) => HttpHandler
options: <
TSearchParams extends Record<string, string>,
THeaders extends Record<string, string>,
Params extends PathParams<keyof Params> = PathParams,
ResponseBody extends DefaultBodyType = DefaultBodyType,
>
(
path: string,
matchers: MatcherOptions<TSearchParams, THeaders>,
response: ResponseResolver<HttpRequestResolverExtras<Params>, never, ResponseBody>,
options?: HandlerOptions,
) => HttpHandler

Add Package

deno add jsr:@dhau/msw-builders

Import symbol

import { type RestHandlersFactory } from "@dhau/msw-builders";

---- OR ----

Import directly with a jsr specifier

import { type RestHandlersFactory } from "jsr:@dhau/msw-builders";

Add Package

npx jsr add @dhau/msw-builders

Import symbol

import { type RestHandlersFactory } from "@dhau/msw-builders";

Add Package

yarn dlx jsr add @dhau/msw-builders

Import symbol

import { type RestHandlersFactory } from "@dhau/msw-builders";

Add Package

pnpm dlx jsr add @dhau/msw-builders

Import symbol

import { type RestHandlersFactory } from "@dhau/msw-builders";

Add Package

bunx jsr add @dhau/msw-builders

Import symbol

import { type RestHandlersFactory } from "@dhau/msw-builders";