Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score100%
Downloads10/wk
Published6 months ago (0.5.1)

Save API responses for testing.

HTTP Saver JSR

Save API responses for testing.

Usage

const httpSaver = new HttpSaver()

Deno.test('some API', () => {
    using _ = httpSaver.stubFetch()

    // First time the test runs, the response will be saved under `_fixtures/responses`
    // Subsequent test runs will use the saved response, without making a network request
    const res = await fetch('https://api.example.com')

    // ... do something with `res`
})
Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@li/http-saver

Import symbol

import * as http_saver from "@li/http-saver";
or

Import directly with a jsr specifier

import * as http_saver from "jsr:@li/http-saver";

Add Package

pnpm i jsr:@li/http-saver
or (using pnpm 10.8 or older)
pnpm dlx jsr add @li/http-saver

Import symbol

import * as http_saver from "@li/http-saver";

Add Package

yarn add jsr:@li/http-saver
or (using Yarn 4.8 or older)
yarn dlx jsr add @li/http-saver

Import symbol

import * as http_saver from "@li/http-saver";

Add Package

vlt install jsr:@li/http-saver

Import symbol

import * as http_saver from "@li/http-saver";

Add Package

npx jsr add @li/http-saver

Import symbol

import * as http_saver from "@li/http-saver";

Add Package

bunx jsr add @li/http-saver

Import symbol

import * as http_saver from "@li/http-saver";