MCPcopy Create free account
hub / github.com/vercel/vercel / directFetch

Function directFetch

packages/cli/src/util/fetch.ts:83–103  ·  view source on GitHub ↗
(
  input: RequestInfo,
  init?: RequestInit
)

Source from the content-addressed store, hash-verified

81 * that does not list `127.0.0.1`/`localhost` in `no_proxy`.
82 */
83export function directFetch(
84 input: RequestInfo,
85 init?: RequestInit
86): Promise<Response> {
87 const options = { ...init } as RequestInit & {
88 dispatcher?: FetchDispatcher;
89 duplex?: 'half';
90 };
91
92 // Ensure no dispatcher (proxy or otherwise) is applied.
93 delete options.dispatcher;
94
95 if (init?.body instanceof Readable) {
96 options.duplex = 'half';
97 }
98
99 return globalThis.fetch(
100 input,
101 options as unknown as NativeRequestInit
102 ) as Promise<Response>;
103}
104
105export function toNodeReadable(body: Response['body']): Readable {
106 if (!body) {

Callers 3

fetch.test.tsFile · 0.90
dispatchToConsumerMethod · 0.90
DevServerClass · 0.90

Calls 1

fetchMethod · 0.45

Tested by

no test coverage detected