Visitar URL original
fix(favicons): annotate the presenter so each branch is checked again… · simstudioai/sim@ddc6806 · GitHub
Skip to content

Commit ddc6806

Browse files
committed
fix(favicons): annotate the presenter so each branch is checked against its own descriptor
1 parent 9109940 commit ddc6806

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/sim/app/api/favicon/route.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import {
55
internalRateLimits,
66
internalSessionAuth,
77
} from '@/lib/api/server/routes'
8+
import type {
9+
BinaryResponseDescriptor,
10+
NoContentResponseDescriptor,
11+
} from '@/lib/api/server/routes/types'
812
import { getFavicon } from '@/lib/favicon/application'
913

1014
export const GET = defineInternalBinaryRoute({
@@ -20,7 +24,7 @@ export const GET = defineInternalBinaryRoute({
2024
mapInput: ({ query }) => ({ host: query.host }),
2125
useCase: getFavicon,
2226
/** No icon is an ordinary answer, not an error: 204, which an `<img>` still reports as failed. */
23-
present: (favicon) =>
27+
present: (favicon): BinaryResponseDescriptor | NoContentResponseDescriptor =>
2428
favicon.kind === 'hit'
2529
? {
2630
body: new Uint8Array(favicon.bytes),
@@ -32,7 +36,7 @@ export const GET = defineInternalBinaryRoute({
3236
},
3337
}
3438
: {
35-
status: 204 as const,
39+
status: 204,
3640
headers: {
3741
'Cache-Control': favicon.kind === 'miss' ? 'private, max-age=3600' : 'no-store',
3842
},

0 commit comments

Comments
 (0)