mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-21 14:40:05 -05:00
decaffeinate: Run post-processing cleanups on ca.coffee and 11 other files
This commit is contained in:
committed by
Zach Bloomquist
parent
34b52074c1
commit
900286b1fb
@@ -1,48 +1,56 @@
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
// Sanity-check the conversion and remove this comment.
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const url = require("url");
|
||||
const url = require('url')
|
||||
|
||||
module.exports = {
|
||||
parseHost(hostString, defaultPort) {
|
||||
let m;
|
||||
if (m = hostString.match(/^http:\/\/(.*)/)) {
|
||||
const parsedUrl = url.parse(hostString);
|
||||
parseHost (hostString, defaultPort) {
|
||||
let m
|
||||
|
||||
m = hostString.match(/^http:\/\/(.*)/)
|
||||
|
||||
if (m) {
|
||||
const parsedUrl = url.parse(hostString)
|
||||
|
||||
return {
|
||||
host: parsedUrl.hostname,
|
||||
port: parsedUrl.port
|
||||
};
|
||||
port: parsedUrl.port,
|
||||
}
|
||||
}
|
||||
|
||||
const hostPort = hostString.split(':');
|
||||
const host = hostPort[0];
|
||||
const port = hostPort.length === 2 ? +hostPort[1] : defaultPort;
|
||||
const hostPort = hostString.split(':')
|
||||
const host = hostPort[0]
|
||||
const port = hostPort.length === 2 ? +hostPort[1] : defaultPort
|
||||
|
||||
return {
|
||||
host,
|
||||
port
|
||||
};
|
||||
port,
|
||||
}
|
||||
},
|
||||
|
||||
hostAndPort(reqUrl, headers, defaultPort) {
|
||||
let m;
|
||||
hostAndPort (reqUrl, headers, defaultPort) {
|
||||
let m
|
||||
const {
|
||||
host
|
||||
} = headers;
|
||||
host,
|
||||
} = headers
|
||||
|
||||
const hostPort = this.parseHost(host, defaultPort);
|
||||
const hostPort = this.parseHost(host, defaultPort)
|
||||
|
||||
//# this handles paths which include the full url. This could happen if it's a proxy
|
||||
if (m = reqUrl.match(/^http:\/\/([^\/]*)\/?(.*)$/)) {
|
||||
const parsedUrl = url.parse(reqUrl);
|
||||
hostPort.host = parsedUrl.hostname;
|
||||
hostPort.port = parsedUrl.port;
|
||||
reqUrl = parsedUrl.path;
|
||||
// this handles paths which include the full url. This could happen if it's a proxy
|
||||
m = reqUrl.match(/^http:\/\/([^\/]*)\/?(.*)$/)
|
||||
|
||||
if (m) {
|
||||
const parsedUrl = url.parse(reqUrl)
|
||||
|
||||
hostPort.host = parsedUrl.hostname
|
||||
hostPort.port = parsedUrl.port
|
||||
reqUrl = parsedUrl.path
|
||||
}
|
||||
|
||||
return hostPort;
|
||||
}
|
||||
};
|
||||
return hostPort
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user