summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/fetch.ts
blob: 14f1d233a10cdc17ead26212dd7f8431da886575 (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),
};