File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ module.exports = function(app) {
1010
1111 app . use ( root , ( req , res , next ) => {
1212 const { headers, method } = req ;
13- const routeList = route . list ( ) ;
1413 const url = decodeURIComponent ( req . url ) ;
1514 const acceptEncoding = headers [ 'accept-encoding' ] || '' ;
1615 const reqUrl = url . endsWith ( '/' ) ? url . concat ( 'index.html' ) : url ;
@@ -21,10 +20,10 @@ module.exports = function(app) {
2120
2221 res . setHeader ( 'Content-Type' , contentType + '; charset=utf-8' ) ;
2322
24- if ( acceptEncoding . includes ( 'br' ) && ( routeList . includes ( url . slice ( 1 ) + '.br' ) || url . endsWith ( '/' ) ) ) {
23+ if ( acceptEncoding . includes ( 'br' ) && ( route . get ( url . slice ( 1 ) + '.br' ) || url . endsWith ( '/' ) ) ) {
2524 req . url = encodeURI ( reqUrl + '.br' ) ;
2625 res . setHeader ( 'Content-Encoding' , 'br' ) ;
27- } else if ( acceptEncoding . includes ( 'gzip' ) && ( routeList . includes ( url . slice ( 1 ) + '.gz' ) || url . endsWith ( '/' ) ) ) {
26+ } else if ( acceptEncoding . includes ( 'gzip' ) && ( route . get ( url . slice ( 1 ) + '.gz' ) || url . endsWith ( '/' ) ) ) {
2827 req . url = encodeURI ( reqUrl + '.gz' ) ;
2928 res . setHeader ( 'Content-Encoding' , 'gzip' ) ;
3029 }
You can’t perform that action at this time.
0 commit comments