0.0.4 • Published 11 months ago

msw-vcr v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

msw-vcr

msw wrapper to record and replay network requests

Usage

import { setupServer } from "msw-vcr";

async function exampleGithubFetch() {
  return fetch("https://api.github.com/orgs/nodejs", {
    credentials: "include",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json",
    },
  }).then((response) => response.json() as Promise<unknown>);
}

const cassetteDir = path.join(__dirname, "vcr");

const vcr = setupServer({
  cassetteDir: cassetteDir,
  onUnhandledRequest: process.env['VCR'] ? "record" : "error",
});

await vcr.cassette("github", exampleGithubFetch);
0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago