diff --git a/lib/routes.test.ts b/lib/routes.test.ts index 6edc3cdc7..967297648 100644 --- a/lib/routes.test.ts +++ b/lib/routes.test.ts @@ -79,4 +79,10 @@ describe('router', () => { expect(await response.text()).toBe('User-agent: *\nDisallow: /'); expect(response.headers.get('content-type')).toBe('text/plain'); }); + + // favicon.ico + it('/favicon.ico', async () => { + const response = await app.request('/favicon.ico'); + expect(response.status).toBe(200); + }); }); diff --git a/lib/routes.ts b/lib/routes.ts index 6470201d7..4c5406130 100644 --- a/lib/routes.ts +++ b/lib/routes.ts @@ -48,6 +48,7 @@ export default function (app: Hono) { '/*', serveStatic({ root: './lib/assets', + rewriteRequestPath: (path) => (path === '/favicon.ico' ? '/favicon.png' : path), }) ); }