fix: favicon not found (#14598)

This commit is contained in:
Tony
2024-02-29 23:30:36 +08:00
committed by GitHub
parent 0d79eaec80
commit d35c47e444
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -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);
});
});
+1
View File
@@ -48,6 +48,7 @@ export default function (app: Hono) {
'/*',
serveStatic({
root: './lib/assets',
rewriteRequestPath: (path) => (path === '/favicon.ico' ? '/favicon.png' : path),
})
);
}