mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: fix proxy-related tests (#8753)
This commit is contained in:
parent
af92fc8f32
commit
af78cc768f
@ -27,7 +27,21 @@ import type {Browser} from '../../lib/cjs/puppeteer/common/Browser.js';
|
|||||||
import type {AddressInfo} from 'net';
|
import type {AddressInfo} from 'net';
|
||||||
import {TestServer} from '../../utils/testserver/lib/index.js';
|
import {TestServer} from '../../utils/testserver/lib/index.js';
|
||||||
|
|
||||||
const HOSTNAME = os.hostname().toLowerCase();
|
let HOSTNAME = os.hostname();
|
||||||
|
|
||||||
|
// Hostname might not be always accessible in environments other than GitHub
|
||||||
|
// Actions. Therefore, we try to find an external IPv4 address to be used as a
|
||||||
|
// hostname in these tests.
|
||||||
|
const networkInterfaces = os.networkInterfaces();
|
||||||
|
for (const key of Object.keys(networkInterfaces)) {
|
||||||
|
const interfaces = networkInterfaces[key];
|
||||||
|
for (const net of interfaces || []) {
|
||||||
|
if (net.family === 'IPv4' && !net.internal) {
|
||||||
|
HOSTNAME = net.address;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests to localhost do not get proxied by default. Create a URL using the hostname
|
* Requests to localhost do not get proxied by default. Create a URL using the hostname
|
||||||
|
Loading…
Reference in New Issue
Block a user