MCPcopy
hub / github.com/claude-code-best/claude-code / handleGet

Function handleGet

packages/cloud-artifacts/src/index.ts:33–48  ·  view source on GitHub ↗
(url: URL, env: Env)

Source from the content-addressed store, hash-verified

31
32// GET /7d/<id>.html 或 /30d/<id>.html —— 从 R2 读,返回 text/html
33async function handleGet(url: URL, env: Env): Promise<Response> {
34 const match = GET_PATH_PATTERN.exec(url.pathname)
35 if (!match) {
36 return json({ error: 'not_found' }, 404)
37 }
38 const [, prefix, id] = match
39 const obj = await env.BUCKET.get(`${prefix}/${id}.html`)
40 if (obj === null) {
41 return new Response('Not Found', { status: 404 })
42 }
43 const headers = new Headers()
44 obj.writeHttpMetadata(headers)
45 headers.set('content-type', HTML_CONTENT_TYPE)
46 headers.set('cache-control', 'public, max-age=86400')
47 return new Response(obj.body, { headers, status: 200 })
48}
49
50async function handleUpload(
51 req: Request,

Callers 1

fetchFunction · 0.85

Calls 3

jsonFunction · 0.85
setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected