Skip to content

Commit

Permalink
Merge pull request #58 from askwonder/master
Browse files Browse the repository at this point in the history
Add proxy option to MailchimpAPI
  • Loading branch information
wulfsolter committed Jan 28, 2019
2 parents 0a87f8e + 28c1cbf commit b2804da
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/mailchimp/MailChimpAPI_v1_1.js
Expand Up @@ -24,6 +24,7 @@ function MailChimpAPI_v1_1 (apiKey, options) {
this.httpHost = this.datacenter+'.api.mailchimp.com';
this.httpUri = (this.secure) ? 'https://'+this.httpHost+':443' : 'http://'+this.httpHost+':80';
this.userAgent = options.userAgent+' ' || '';
this.proxy = options.proxy;

}

Expand Down Expand Up @@ -55,7 +56,8 @@ MailChimpAPI_v1_1.prototype.execute = function (method, availableParams, givenPa
uri : this.httpUri+'/'+this.version+'/?output=json&method='+method,
method: 'POST',
headers : { 'User-Agent' : this.userAgent+'node-mailchimp/'+this.packageInfo['version'] },
body : encodeURIComponent(JSON.stringify(finalParams))
body : encodeURIComponent(JSON.stringify(finalParams)),
proxy : this.proxy,
}, function (error, response, body) {
helpers.handleMailChimpResponse(error, response, body, callback);
});
Expand Down
4 changes: 3 additions & 1 deletion lib/mailchimp/MailChimpAPI_v1_2.js
Expand Up @@ -24,6 +24,7 @@ function MailChimpAPI_v1_2 (apiKey, options) {
this.httpHost = this.datacenter+'.api.mailchimp.com';
this.httpUri = (this.secure) ? 'https://'+this.httpHost+':443' : 'http://'+this.httpHost+':80';
this.userAgent = options.userAgent+' ' || '';
this.proxy = options.proxy;

}

Expand Down Expand Up @@ -55,7 +56,8 @@ MailChimpAPI_v1_2.prototype.execute = function (method, availableParams, givenPa
uri : this.httpUri+'/'+this.version+'/?output=json&method='+method,
method: 'POST',
headers : { 'User-Agent' : this.userAgent+'node-mailchimp/'+this.packageInfo['version'] },
body : encodeURIComponent(JSON.stringify(finalParams))
body : encodeURIComponent(JSON.stringify(finalParams)),
proxy : this.proxy,
}, function (error, response, body) {
helpers.handleMailChimpResponse(error, response, body, callback);
});
Expand Down
4 changes: 3 additions & 1 deletion lib/mailchimp/MailChimpAPI_v1_3.js
Expand Up @@ -24,6 +24,7 @@ function MailChimpAPI_v1_3 (apiKey, options) {
this.httpHost = this.datacenter+'.api.mailchimp.com';
this.httpUri = (this.secure) ? 'https://'+this.httpHost+':443' : 'http://'+this.httpHost+':80';
this.userAgent = options.userAgent+' ' || '';
this.proxy = options.proxy;

}

Expand Down Expand Up @@ -55,7 +56,8 @@ MailChimpAPI_v1_3.prototype.execute = function (method, availableParams, givenPa
uri : this.httpUri+'/'+this.version+'/?method='+method,
method: 'POST',
headers : { 'User-Agent' : this.userAgent+'node-mailchimp/'+this.packageInfo['version'] },
body : encodeURIComponent(JSON.stringify(finalParams))
body : encodeURIComponent(JSON.stringify(finalParams)),
proxy : this.proxy,
}, function (error, response, body) {
helpers.handleMailChimpResponse(error, response, body, callback);
});
Expand Down
4 changes: 3 additions & 1 deletion lib/mailchimp/MailChimpAPI_v2_0.js
Expand Up @@ -22,6 +22,7 @@ function MailChimpAPI_v2_0 (apiKey, options) {
this.httpHost = this.datacenter+'.api.mailchimp.com';
this.httpUri = 'https://'+this.httpHost+':443';
this.userAgent = options.userAgent+' ' || '';
this.proxy = options.proxy;

}

Expand Down Expand Up @@ -54,7 +55,8 @@ MailChimpAPI_v2_0.prototype.execute = function (method, availableParams, givenPa
method: 'POST',
headers : { 'User-Agent' : this.userAgent+'node-mailchimp/'+this.packageInfo.version, "accept-encoding" : "gzip,deflate" },
gzip: true,
body : JSON.stringify(finalParams)
body : JSON.stringify(finalParams),
proxy : this.proxy,
}, function (error, response, body) {
helpers.handleMailChimpResponse(error, response, body, callback);
});
Expand Down

0 comments on commit b2804da

Please sign in to comment.