Unverified Commit 7f1c8a9b authored by Radosław Grochowski's avatar Radosław Grochowski Committed by GitHub

fix: handle compression for custom-server render calls (#16378) (#18891)

Co-authored-by: 's avatarRadosław Grochowski <radoslaw.grochowski@grupawp.pl>
Co-authored-by: 's avatarTim Neutkens <timneutkens@me.com>
parent 9d25194e
......@@ -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')
}
)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment