Skip to content

Commit

Permalink
Fixing http adapter to allow HTTPS connections via HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
zcei committed Jun 15, 2017
1 parent 46e275c commit 27375aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -14,6 +14,7 @@ export interface AxiosBasicCredentials {
export interface AxiosProxyConfig {
host: string;
port: number;
isHttps?: boolean;
}

export interface AxiosRequestConfig {
Expand Down
5 changes: 3 additions & 2 deletions lib/adapters/http.js
Expand Up @@ -118,13 +118,14 @@ module.exports = function httpAdapter(config) {
}

var transport;
var useHttps = isHttps && proxy.isHttps;
if (config.maxRedirects === 0) {
transport = isHttps ? https : http;
transport = useHttps ? https : http;
} else {
if (config.maxRedirects) {
options.maxRedirects = config.maxRedirects;
}
transport = isHttps ? httpsFollow : httpFollow;
transport = useHttps ? httpsFollow : httpFollow;
}

// Create the request
Expand Down

0 comments on commit 27375aa

Please sign in to comment.