import * as path from '@std/path'; /** * Any request that is for something with the extension 'foo' should return 'foo' * * @param request The incoming HTTP request * @returns Either a response (a foo) or undefined if unhandled. */ export default function handle_static_files(request: Request): Response | undefined { const url: URL = new URL(request.url); const extension: string = path.extname(url.pathname)?.slice(1)?.toLowerCase() ?? ''; if (extension !== 'foo') { return; } return new Response('foo', { status: 200, headers: { 'Content-Type': 'text/plain' } }); }