fix: grid connection invalid method (#17706)

This patch fixes invalid method (GET instead of POST) used when
connecting to Selenium Grid by http with proxy.

Fixes #17707
This commit is contained in:
wodyjowski 2022-09-30 09:41:03 +02:00 committed by GitHub
parent f1f4af2f7d
commit 33bbb15e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,15 +50,16 @@ export function httpRequest(params: HTTPRequestParams, onResponse: (r: http.Inco
const proxyURL = getProxyForUrl(params.url);
if (proxyURL) {
const parsedProxyURL = URL.parse(proxyURL);
if (params.url.startsWith('http:')) {
const proxy = URL.parse(proxyURL);
options = {
path: parsedUrl.href,
host: proxy.hostname,
port: proxy.port,
host: parsedProxyURL.hostname,
port: parsedProxyURL.port,
headers: options.headers,
method: options.method
};
} else {
const parsedProxyURL = URL.parse(proxyURL);
(parsedProxyURL as any).secureProxy = parsedProxyURL.protocol === 'https:';
options.agent = new HttpsProxyAgent(parsedProxyURL);