Update type and changeset

Signed-off-by: Dominik Henneke <dominik.henneke@sda-se.com>
This commit is contained in:
Dominik Henneke
2021-03-08 11:37:35 +01:00
parent 173ed924b7
commit e6fa667639
2 changed files with 9 additions and 4 deletions
+7 -2
View File
@@ -23,6 +23,9 @@ import { resolve as resolvePath } from 'path';
import { Logger } from 'winston';
import { injectConfig, readConfigs } from '../lib/config';
// express uses mime v1 while we only have types for mime v2
type Mime = { lookup(arg0: string): string };
export interface RouterOptions {
config: Config;
logger: Logger;
@@ -101,8 +104,10 @@ export async function createRouter(
// The Cache-Control header instructs the browser to not cache html files since it might
// link to static assets from recently deployed versions. This is a workaround when no
// staticFallbackHandler is configured.
// use `as any` since express uses mime v1 while we only have types for mime v2
if ((express.static.mime as any).lookup(path) === 'text/html') {
if (
((express.static.mime as unknown) as Mime).lookup(path) ===
'text/html'
) {
res.setHeader('Cache-Control', 'no-store, max-age=0');
}
},