Co-authored-by: Radosław Grochowski <radoslaw.grochowski@grupawp.pl> Co-authored-by: Tim Neutkens <timneutkens@me.com>
This commit is contained in:
parent
9d25194e7d
commit
7f1c8a9bbe
2 changed files with 18 additions and 0 deletions
|
@ -1315,6 +1315,11 @@ export default class Server {
|
|||
return this.handleRequest(req, res, parsedUrl)
|
||||
}
|
||||
|
||||
// Custom server users can run `app.render()` which needs compression.
|
||||
if (this.renderOpts.customServer) {
|
||||
this.handleCompression(req, res)
|
||||
}
|
||||
|
||||
if (isBlockedPage(pathname)) {
|
||||
return this.render404(req, res, parsedUrl)
|
||||
}
|
||||
|
|
|
@ -183,4 +183,17 @@ describe('Custom Server', () => {
|
|||
expect(stderr).toContain('Cannot render page with path "dashboard"')
|
||||
})
|
||||
})
|
||||
|
||||
describe('compression handling', function () {
|
||||
beforeAll(() => startServer())
|
||||
afterAll(() => killApp(server))
|
||||
|
||||
it.each(['/', '/no-query'])(
|
||||
'should handle compression for route %s',
|
||||
async (route) => {
|
||||
const response = await fetchViaHTTP(appPort, route)
|
||||
expect(response.headers.get('Content-Encoding')).toBe('gzip')
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue