Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
This commit is contained in:
parent
9b11b6a4e0
commit
ddb0cc174d
@ -354,6 +354,9 @@ export class Frame {
|
||||
referrerPolicy,
|
||||
});
|
||||
ensureNewDocumentNavigation = !!response.loaderId;
|
||||
if (response.errorText === 'net::ERR_HTTP_RESPONSE_CODE_FAILURE') {
|
||||
return null;
|
||||
}
|
||||
return response.errorText
|
||||
? new Error(`${response.errorText} at ${url}`)
|
||||
: null;
|
||||
|
@ -304,6 +304,30 @@ describe('navigation', function () {
|
||||
expect(response.ok()).toBe(false);
|
||||
expect(response.status()).toBe(404);
|
||||
});
|
||||
it('should not throw an error for a 404 response with an empty body', async () => {
|
||||
const {page, server} = getTestState();
|
||||
|
||||
server.setRoute('/404-error', (_, res) => {
|
||||
res.statusCode = 404;
|
||||
res.end();
|
||||
});
|
||||
|
||||
const response = (await page.goto(server.PREFIX + '/404-error'))!;
|
||||
expect(response.ok()).toBe(false);
|
||||
expect(response.status()).toBe(404);
|
||||
});
|
||||
it('should not throw an error for a 500 response with an empty body', async () => {
|
||||
const {page, server} = getTestState();
|
||||
|
||||
server.setRoute('/500-error', (_, res) => {
|
||||
res.statusCode = 500;
|
||||
res.end();
|
||||
});
|
||||
|
||||
const response = (await page.goto(server.PREFIX + '/500-error'))!;
|
||||
expect(response.ok()).toBe(false);
|
||||
expect(response.status()).toBe(500);
|
||||
});
|
||||
it('should return last response in redirect chain', async () => {
|
||||
const {page, server} = getTestState();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user