This reverts commit 17bc8f9a15.
Reference https://github.com/microsoft/playwright/issues/28779
Fixes https://github.com/microsoft/playwright/issues/29441
This commit is contained in:
parent
2550ba3396
commit
2693614c7a
|
|
@ -760,8 +760,6 @@ class ResponseExtraInfoTracker {
|
||||||
if (response && responseExtraInfo) {
|
if (response && responseExtraInfo) {
|
||||||
response.setResponseHeadersSize(responseExtraInfo.headersText?.length || 0);
|
response.setResponseHeadersSize(responseExtraInfo.headersText?.length || 0);
|
||||||
response.setRawResponseHeaders(headersObjectToArray(responseExtraInfo.headers, '\n'));
|
response.setRawResponseHeaders(headersObjectToArray(responseExtraInfo.headers, '\n'));
|
||||||
// This is racy, but proper fix reuquires risky changes, so we doing best effort here.
|
|
||||||
response.setRawStatus(responseExtraInfo.statusCode, getStatusText(responseExtraInfo.headersText));
|
|
||||||
info.responseReceivedExtraInfo[index] = undefined;
|
info.responseReceivedExtraInfo[index] = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -783,11 +781,3 @@ class ResponseExtraInfoTracker {
|
||||||
this._requests.delete(requestId);
|
this._requests.delete(requestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStatusText(headersText?: string): string {
|
|
||||||
if (!headersText)
|
|
||||||
return '';
|
|
||||||
const statusLine = headersText.split('\n')[0];
|
|
||||||
const match = statusLine.match(/\S+\s+\d+\s*(.*)/);
|
|
||||||
return match?.[1] ?? '';
|
|
||||||
}
|
|
||||||
|
|
@ -464,11 +464,6 @@ export class Response extends SdkObject {
|
||||||
this._transferSizePromise.resolve(size);
|
this._transferSizePromise.resolve(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
setRawStatus(status: number, statusText: string) {
|
|
||||||
this._status = status;
|
|
||||||
this._statusText = statusText;
|
|
||||||
}
|
|
||||||
|
|
||||||
setEncodedBodySize(size: number | null) {
|
setEncodedBodySize(size: number | null) {
|
||||||
this._encodedBodySizePromise.resolve(size);
|
this._encodedBodySizePromise.resolve(size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -451,6 +451,7 @@ it('should not allow to access frame on popup main request', async ({ page, serv
|
||||||
|
|
||||||
it('page.reload return 304 status code', async ({ page, server, browserName }) => {
|
it('page.reload return 304 status code', async ({ page, server, browserName }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28779' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28779' });
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29441' });
|
||||||
it.fixme(browserName === 'firefox', 'Does not send second request');
|
it.fixme(browserName === 'firefox', 'Does not send second request');
|
||||||
let requestNumber = 0;
|
let requestNumber = 0;
|
||||||
server.setRoute('/test.html', (req, res) => {
|
server.setRoute('/test.html', (req, res) => {
|
||||||
|
|
@ -473,8 +474,9 @@ it('page.reload return 304 status code', async ({ page, server, browserName }) =
|
||||||
const response2 = await page.reload();
|
const response2 = await page.reload();
|
||||||
expect(requestNumber).toBe(2);
|
expect(requestNumber).toBe(2);
|
||||||
if (browserName === 'chromium') {
|
if (browserName === 'chromium') {
|
||||||
expect([200, 304].includes(response2.status()), 'actual status: ' + response2.status());
|
expect(response2.status()).toBe(200);
|
||||||
expect(['OK', 'Not Modified'].includes(response2.statusText()), 'actual statusText: ' + response2.statusText());
|
expect(response2.statusText()).toBe('OK');
|
||||||
|
expect(await response2.text()).toBe('<div>Test</div>');
|
||||||
} else {
|
} else {
|
||||||
expect(response2.status()).toBe(304);
|
expect(response2.status()).toBe(304);
|
||||||
expect(response2.statusText()).toBe('Not Modified');
|
expect(response2.statusText()).toBe('Not Modified');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue