mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(fetch): ignoreHTTPSErrors after redirects (#9806)
This commit is contained in:
parent
c8addef03a
commit
dd0dae623b
@ -231,7 +231,7 @@ export abstract class FetchRequest extends SdkObject {
|
||||
delete headers[`content-type`];
|
||||
}
|
||||
|
||||
const redirectOptions: http.RequestOptions & { maxRedirects: number, deadline: number } = {
|
||||
const redirectOptions: https.RequestOptions & { maxRedirects: number, deadline: number } = {
|
||||
method,
|
||||
headers,
|
||||
agent: options.agent,
|
||||
@ -239,6 +239,9 @@ export abstract class FetchRequest extends SdkObject {
|
||||
timeout: options.timeout,
|
||||
deadline: options.deadline
|
||||
};
|
||||
// rejectUnauthorized = undefined is treated as true in node 12.
|
||||
if (options.rejectUnauthorized === false)
|
||||
redirectOptions.rejectUnauthorized = false;
|
||||
|
||||
// HTTP-redirect fetch step 4: If locationURL is null, then return response.
|
||||
if (response.headers.location) {
|
||||
|
@ -146,6 +146,13 @@ it('should support global ignoreHTTPSErrors option', async ({ playwright, httpsS
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
|
||||
it('should propagate ignoreHTTPSErrors on redirects', async ({ playwright, httpsServer }) => {
|
||||
httpsServer.setRedirect('/redir', '/empty.html');
|
||||
const request = await playwright.request.newContext();
|
||||
const response = await request.get(httpsServer.PREFIX + '/redir', { ignoreHTTPSErrors: true });
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
|
||||
it('should resolve url relative to gobal baseURL option', async ({ playwright, server }) => {
|
||||
const request = await playwright.request.newContext({ baseURL: server.PREFIX });
|
||||
const response = await request.get('/empty.html');
|
||||
|
Loading…
x
Reference in New Issue
Block a user