summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/fetch.ts
blob: ddb52bb95dd9ca1836813436291f48d1821a9248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { crossFetch } from "../deps.ts";

/**
 * A simple method for requesting data via standard `fetch`. Should work
 * across multiple runtimes.
 */
export function fetch(url: string): Promise<Response> {
  return _fetchInternals.stubThis(url);
}

// Make it possible to stub the return value during testing
export const _fetchInternals = {
  stubThis: (url: string) => crossFetch(url),
};