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

Function apiFetch

packages/cli/test/helpers/api-fetch.ts:3–18  ·  view source on GitHub ↗
(
  path: string,
  { headers, ...options }: RequestInit = {}
)

Source from the content-addressed store, hash-verified

1import nodeFetch, { type RequestInit } from '../../src/util/fetch';
2
3export const apiFetch = (
4 path: string,
5 { headers, ...options }: RequestInit = {}
6) => {
7 const url = new URL(path, 'https://api.vercel.com');
8 if (process.env.VERCEL_TEAM_ID) {
9 url.searchParams.set('teamId', process.env.VERCEL_TEAM_ID);
10 }
11 return nodeFetch(url, {
12 headers: {
13 Authorization: `Bearer ${process.env.VERCEL_TOKEN}`,
14 ...(headers || {}),
15 },
16 ...options,
17 });
18};

Callers 6

getUserFunction · 0.90
getTeamFunction · 0.90

Calls 1

setMethod · 0.45

Tested by 1