MCPcopy
hub / github.com/QwikDev/qwik / notFound

Function notFound

packages/qwik-city/src/middleware/bun/index.ts:111–132  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

109 }
110
111 const notFound = async (request: Request) => {
112 try {
113 const url = getRequestUrl(request, opts);
114
115 // In the development server, we replace the getNotFound function
116 // For static paths, we assign a static "Not Found" message.
117 // This ensures consistency between development and production environments for specific URLs.
118 const notFoundHtml = isStaticPath(request.method || 'GET', url)
119 ? 'Not Found'
120 : getNotFound(url.pathname);
121 return new Response(notFoundHtml, {
122 status: 404,
123 headers: { 'Content-Type': 'text/html; charset=utf-8', 'X-Not-Found': url.pathname },
124 });
125 } catch (e) {
126 console.error(e);
127 return new Response(String(e || 'Error'), {
128 status: 500,
129 headers: { 'Content-Type': 'text/plain; charset=utf-8', 'X-Error': 'bun-server' },
130 });
131 }
132 };
133
134 const openStaticFile = async (url: URL) => {
135 const pathname = url.pathname;

Callers 7

handleFunction · 0.50
qwikAppFunction · 0.50
qwikPluginFunction · 0.50
entry.deno.tsFile · 0.50
fetchFunction · 0.50

Calls 3

isStaticPathFunction · 0.85
getNotFoundFunction · 0.85
getRequestUrlFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…