Skip to content

deckchairlabs/fetching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦚 fetching

GitHub Workflow Status Deno module Deno compatibility

An enhanced fetch for Deno.

Usage

import { createFetching } from "https://deno.land/x/fetching@v0.0.2/mod.ts";
import { prettyLog } from "https://deno.land/x/fetching@v0.0.2/lib/prettyLog.ts";

const fetching = createFetching({
  // The Cache API is supported
  cache: await caches.open("v1"),
  log: prettyLog,
  allowedOrigins: [{
    hostname: "httpbin.org",
  }],
});

// You can do this, or not
globalThis.fetch = fetching;

// This request will succeed!
await fetch("https://httpbin.org/get");

// This request will fail since we have not configured it as an allowedOrigin
await fetch("https://jsonplaceholder.typicode.com/todos/1");

About

An enhanced fetch for Deno.

Resources

Stars

Watchers

Forks

Packages

No packages published