MCPcopy Index your code
hub / github.com/unpkg/unpkg / jsonError

Function jsonError

packages/unpkg-esm/src/request-handler.ts:577–593  ·  view source on GitHub ↗
(error: EsmRequestError | { code: string; message: string; status: number })

Source from the content-addressed store, hash-verified

575}
576
577function jsonError(error: EsmRequestError | { code: string; message: string; status: number }): Response {
578 return Response.json(
579 {
580 error: {
581 code: error.code,
582 message: error.message,
583 },
584 },
585 {
586 status: error.status,
587 headers: corsHeaders({
588 "Cache-Control": "public, max-age=60, s-maxage=300",
589 "Content-Type": "application/json",
590 }),
591 }
592 );
593}
594
595function corsHeaders(headers?: HeadersInit): HeadersInit {
596 return {

Callers 3

handleRequestFunction · 0.85
getBuildIntegrityFunction · 0.85
serveRawFileFunction · 0.85

Calls 1

corsHeadersFunction · 0.85

Tested by

no test coverage detected