File tree 3 files changed +6
-12
lines changed
3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,9 @@ export interface ISRHandlerConfig {
134
134
compressHtml ?: CompressHtmlFn ;
135
135
136
136
/**
137
- * Compression solution , it will use gzip by default if not provided.
137
+ * Cached Html compression method , it will use gzip by default if not provided.
138
138
*/
139
- cacheHtmlCompressionMethod ?: 'gzip' | 'brotli' | undefined | null ;
139
+ htmlCompressionMethod ?: string ;
140
140
}
141
141
142
142
export interface ServeFromCacheConfig {
Original file line number Diff line number Diff line change @@ -236,10 +236,7 @@ export class ISRHandler {
236
236
This resulted into more ${ totalTime } ms of processing time.\n-->` ;
237
237
}
238
238
} else {
239
- setCompressHeader (
240
- res ,
241
- this . isrConfig . cacheHtmlCompressionMethod || 'gzip' ,
242
- ) ;
239
+ setCompressHeader ( res , this . isrConfig . htmlCompressionMethod ) ;
243
240
}
244
241
245
242
return res . send ( finalHtml ) ;
@@ -266,10 +263,7 @@ export class ISRHandler {
266
263
throw new Error ( 'Error while generating the page!' ) ;
267
264
} else {
268
265
if ( this . isrConfig . compressHtml ) {
269
- setCompressHeader (
270
- res ,
271
- this . isrConfig . cacheHtmlCompressionMethod || 'gzip' ,
272
- ) ;
266
+ setCompressHeader ( res , this . isrConfig . htmlCompressionMethod ) ;
273
267
}
274
268
return res . send ( result . html ) ;
275
269
}
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ import * as express from 'express';
3
3
4
4
export function setCompressHeader (
5
5
response : express . Response ,
6
- method : string ,
6
+ method ? : string ,
7
7
) : void {
8
- response . setHeader ( 'Content-Encoding' , method ) ;
8
+ response . setHeader ( 'Content-Encoding' , method || 'gzip' ) ;
9
9
response . setHeader ( 'Content-type' , 'text/html; charset=utf-8' ) ;
10
10
response . setHeader ( 'Vary' , 'Accept-Encoding' ) ;
11
11
}
You can’t perform that action at this time.
0 commit comments