File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
packages/next/next-server/server
test/integration/custom-server/test Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1315,6 +1315,11 @@ export default class Server {
1315
1315
return this . handleRequest ( req , res , parsedUrl )
1316
1316
}
1317
1317
1318
+ // Custom server users can run `app.render()` which needs compression.
1319
+ if ( this . renderOpts . customServer ) {
1320
+ this . handleCompression ( req , res )
1321
+ }
1322
+
1318
1323
if ( isBlockedPage ( pathname ) ) {
1319
1324
return this . render404 ( req , res , parsedUrl )
1320
1325
}
Original file line number Diff line number Diff line change @@ -183,4 +183,17 @@ describe('Custom Server', () => {
183
183
expect ( stderr ) . toContain ( 'Cannot render page with path "dashboard"' )
184
184
} )
185
185
} )
186
+
187
+ describe ( 'compression handling' , function ( ) {
188
+ beforeAll ( ( ) => startServer ( ) )
189
+ afterAll ( ( ) => killApp ( server ) )
190
+
191
+ it . each ( [ '/' , '/no-query' ] ) (
192
+ 'should handle compression for route %s' ,
193
+ async ( route ) => {
194
+ const response = await fetchViaHTTP ( appPort , route )
195
+ expect ( response . headers . get ( 'Content-Encoding' ) ) . toBe ( 'gzip' )
196
+ }
197
+ )
198
+ } )
186
199
} )
You can’t perform that action at this time.
0 commit comments