fix: use HTTP/2.0 instead of h2 as Response.httpVersion (#10812)

This commit is contained in:
Max Schmitt 2021-12-10 11:24:52 -08:00 committed by GitHub
parent 308c7b4e32
commit 0b120c7f03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -434,6 +434,8 @@ export class Response extends SdkObject {
return 'HTTP/1.1';
if (this._httpVersion === 'http/1.1')
return 'HTTP/1.1';
if (this._httpVersion === 'h2')
return 'HTTP/2.0';
return this._httpVersion;
}

View file

@ -512,8 +512,8 @@ it('should contain http2 for http2 requests', async ({ contextFactory, browserNa
const { page, getLog } = await pageWithHar(contextFactory, testInfo);
await page.goto(`https://localhost:${(server.address() as AddressInfo).port}`);
const log = await getLog();
expect(log.entries[0].request.httpVersion).toBe('h2');
expect(log.entries[0].response.httpVersion).toBe('h2');
expect(log.entries[0].request.httpVersion).toBe('HTTP/2.0');
expect(log.entries[0].response.httpVersion).toBe('HTTP/2.0');
expect(Buffer.from(log.entries[0].response.content.text, 'base64').toString()).toBe('<h1>Hello World</h1>');
server.close();
});