Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno_slack_api/dev_deps.ts>mf.mock

Slack API Client for Deno Run on Slack projects
Go to Latest
variable mf.mock
import { mf } from "https://deno.land/x/deno_slack_api@2.1.2/dev_deps.ts";
const { mock } = mf;

Mock a new route, or override an existing handler.

The route uses URLPattern syntax, with the additional extension of (optional) method routing by prefixing with the method, eg. "POST@/user/:id".

The handler function may be asynchronous.

mock("GET@/users/:id", async (_req, params) => {
  const id = parseInt(params["id"]);
  const data = await magicallyGetMyUserData(id);
  return new Response(JSON.stringify(data));
})