test: headers return only last header value for duplicates (#8851)

This commit is contained in:
Yury Semikhatsky 2021-09-10 16:37:10 -07:00 committed by GitHub
parent cfe7c1a7e3
commit 8d6bcfb66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,24 @@ it('should work', async ({page, server}) => {
expect((await response.allHeaders())['BaZ']).toBe(undefined);
});
it('should return last header value for duplicates', async ({page, server}) => {
it.fixme();
server.setRoute('/headers', (req, res) => {
// Headers array is only supported since Node v14.14.0 so we write directly to the socket.
// res.writeHead(200, ['name-a', 'v1','name-b', 'v4','Name-a', 'v2', 'name-A', 'v3']);
const conn = res.connection;
conn.write('HTTP/1.1 200 OK\r\n');
conn.write('Name-A: v1\r\n');
conn.write('Name-a: v2\r\n');
conn.write('name-A: v3\r\n');
conn.write('\r\n');
conn.uncork();
conn.end();
});
const response = await page.goto(`${server.PREFIX}/headers`);
expect(response.status()).toBe(200);
expect(response.headers()['name-a']).toBe('v1, v2, v3');
});
it('should return text', async ({page, server}) => {
const response = await page.goto(server.PREFIX + '/simple.json');