MCPcopy Index your code
hub / github.com/fontsource/fontsource / getVersion

Function getVersion

api/common/util.ts:142–162  ·  view source on GitHub ↗
(id: string, req: Request, env: Env)

Source from the content-addressed store, hash-verified

140};
141
142export const getVersion = async (id: string, req: Request, env: Env) => {
143 const apiPathname = `/v1/version/${id}`;
144 const url = new URL(req.url);
145 url.pathname = apiPathname;
146
147 // Update incoming request to use new pathname
148 const newRequest = new Request(url.toString(), {
149 ...req.clone(),
150 method: 'GET',
151 });
152 const metadata = await env.METADATA.fetch(newRequest);
153 if (!metadata.ok) {
154 const error = await metadata.json<StatusErrorObject>();
155 throw new StatusError(
156 metadata.status,
157 `Bad response from metadata worker. ${error.error}`,
158 );
159 }
160
161 return await metadata.json<VersionResponse>();
162};

Callers 1

splitTagFunction · 0.90

Calls 3

toStringMethod · 0.80
cloneMethod · 0.65
fetchMethod · 0.65

Tested by

no test coverage detected