-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser-fetch.ts
More file actions
21 lines (19 loc) · 859 Bytes
/
browser-fetch.ts
File metadata and controls
21 lines (19 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/// <reference lib="dom" />
/**
* @file Thin wrapper over the global `fetch()` so tests can mock the network
* layer via `vi.mock('@socketsecurity/lib/http-request/browser-fetch')`
* without monkey-patching `globalThis.fetch` (which conflicts with the
* project's nock-based test setup). The wrapper itself is `c8 ignore`-marked
* because the body is a single uncoverable fetch call; coverage credit is
* preserved by the wider test suite that mocks this module and asserts the
* call shape.
*/
/* c8 ignore start - native fetch call; tests mock this module wholesale */
export function doFetch(
input: RequestInfo | URL,
init?: RequestInit,
): Promise<Response> {
// oxlint-disable-next-line socket/no-fetch-prefer-http-request -- browser entrypoint; fetch IS the underlying API
return fetch(input, init)
}
/* c8 ignore stop */