From d41560df6197856dd63678d4e23d0656062ee42f Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 2 Sep 2026 15:48:44 +0100 Subject: [PATCH] test: response.body() for content-encoding:identity --- tests/page/page-network-response.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/page/page-network-response.spec.ts b/tests/page/page-network-response.spec.ts index 6e65a81d1029d..9ec3e8eb6121d 100644 --- a/tests/page/page-network-response.spec.ts +++ b/tests/page/page-network-response.spec.ts @@ -83,6 +83,22 @@ it('should return uncompressed text for brotli encoding', { expect(await response.text()).toBe(text); }); +it('should return text for identity encoding', { + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/42501' }, +}, async ({ page, server }) => { + const text = '
hello
'; + server.setRoute('/identity.html', (req, res) => { + res.writeHead(200, { + 'Content-Type': 'text/html; charset=utf-8', + 'Content-Encoding': 'Identity', + }); + res.end(text); + }); + const response = await page.goto(server.PREFIX + '/identity.html'); + expect(response.headers()['content-encoding']).toBe('Identity'); + expect(await response.text()).toBe(text); +}); + it('should throw when requesting body of redirected response', async ({ page, server }) => { server.setRedirect('/foo.html', '/empty.html'); const response = await page.goto(server.PREFIX + '/foo.html');