/** * @license * Copyright 2021 Google Inc. * SPDX-License-Identifier: Apache-2.0
*/
import type {Server} from 'http'; import http from 'http'; import type {AddressInfo} from 'net'; import os from 'os';
import type {TestServer} from '@pptr/testserver'; import expect from 'expect';
import {getTestState, launch} from './mocha-utils.js';
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 * instead.
*/ function getEmptyPageUrl(server: TestServer): string { const emptyPagePath = new URL(server.EMPTY_PAGE).pathname;
describe('request proxy', () => {
let proxiedRequestUrls: string[];
let proxyServer: Server;
let proxyServerUrl: string; const defaultArgs = [ // We disable this in tests so that proxy-related tests // don't intercept queries from this service in headful. '--disable-features=NetworkTimeServiceQuerying',
];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.