fix bugs related no_proxy and ports: 1) https://foo.com should match no_proxy=foo.com:443 and 2) https://foo.com:8080 should match no_proxy=foo.com

This commit is contained in:
eric sciple
2020-01-22 23:09:35 -05:00
parent 9e8142913f
commit d745dd984c
4 changed files with 138 additions and 61 deletions

View File

@@ -35,13 +35,21 @@ export enum HttpCodes {
GatewayTimeout = 504,
}
/**
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
*/
export function getProxyUrl(serverUrl: string): string {
let proxyUrl = pm.getProxyUrl(url.parse(serverUrl))
return proxyUrl ? proxyUrl.href : ''
}
const HttpRedirectCodes: number[] = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect];
const HttpResponseRetryCodes: number[] = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout];
const RetryableHttpVerbs: string[] = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
const ExponentialBackoffCeiling = 10;
const ExponentialBackoffTimeSlice = 5;
export class HttpClientResponse implements ifm.IHttpClientResponse {
constructor(message: http.IncomingMessage) {
this.message = message;