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

Function getVariableMetadata

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

Source from the content-addressed store, hash-verified

30};
31
32export const getVariableMetadata = async (
33 id: string,
34 req: Request,
35 env: Env,
36) => {
37 const apiPathname = `/v1/variable/${id}`;
38 const url = new URL(req.url);
39 url.pathname = apiPathname;
40
41 // Update incoming request to use new pathname
42 const newRequest = new Request(url.toString(), {
43 ...req.clone(),
44 method: 'GET',
45 });
46 const metadata = await env.METADATA.fetch(newRequest);
47 if (!metadata.ok) {
48 const error = await metadata.json<StatusErrorObject>();
49 throw new StatusError(
50 metadata.status,
51 `Bad response from metadata worker. ${error.error}`,
52 );
53 }
54
55 return await metadata.json<VariableMetadata>();
56};
57
58export const findVersion = (
59 id: string,

Callers 1

router.tsFile · 0.90

Calls 3

toStringMethod · 0.80
cloneMethod · 0.65
fetchMethod · 0.65

Tested by

no test coverage detected