MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / getRequestOptions

Function getRequestOptions

javascript/selenium-webdriver/http/index.js:47–59  ·  view source on GitHub ↗

* @param {string} aUrl The request URL to parse. * @return {RequestOptions} The request options. * @throws {Error} if the URL does not include a hostname.

(aUrl)

Source from the content-addressed store, hash-verified

45 * @throws {Error} if the URL does not include a hostname.
46 */
47function getRequestOptions(aUrl) {
48 // eslint-disable-next-line n/no-deprecated-api
49 let options = url.parse(aUrl)
50 if (!options.hostname) {
51 throw new Error('Invalid URL: ' + aUrl)
52 }
53 // Delete the search and has portions as they are not used.
54 options.search = null
55 options.hash = null
56 options.path = options.pathname
57 options.hostname = options.hostname === 'localhost' ? '127.0.0.1' : options.hostname // To support Node 17 and above. Refer https://github.com/nodejs/node/issues/40702 for details.
58 return options
59}
60
61/** @const {string} */
62const USER_AGENT = (function () {

Callers 1

constructorMethod · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected