diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-08 13:09:26 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-08 13:09:26 -0700 |
commit | d8ecca714e62de0b34c3db896a96deba8573f03b (patch) | |
tree | d1fa47e1edf97a7a25d812142c2bc708555076ca /lib/sendgrid.js | |
parent | 223b7bf6b0f7a918f5dc7d49cef27fab4332fb6a (diff) | |
download | sendgrid-nodejs-d8ecca714e62de0b34c3db896a96deba8573f03b.zip sendgrid-nodejs-d8ecca714e62de0b34c3db896a96deba8573f03b.tar.gz sendgrid-nodejs-d8ecca714e62de0b34c3db896a96deba8573f03b.tar.bz2 |
Fix copy by reference issue
Diffstat (limited to 'lib/sendgrid.js')
-rw-r--r-- | lib/sendgrid.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js index 5e12871..38ab63e 100644 --- a/lib/sendgrid.js +++ b/lib/sendgrid.js @@ -1,11 +1,11 @@ "use strict"; var package_json = require('./../package.json'); -var emptyRequest = require('sendgrid-rest').emptyRequest +var emptyRequest = JSON.parse(JSON.stringify(require('sendgrid-rest').emptyRequest)); // SendGrid allows for quick and easy access to the v3 Web API function SendGrid (apiKey, host, globalHeaders) { var Client = require('sendgrid-rest').Client - var globalRequest = require('sendgrid-rest').emptyRequest + var globalRequest = JSON.parse(JSON.stringify(require('sendgrid-rest').emptyRequest)); globalRequest.host = host || "api.sendgrid.com"; globalRequest.headers['Content-Type'] = 'application/json' globalRequest.headers['Authorization'] = 'Bearer '.concat(apiKey) @@ -20,7 +20,7 @@ function SendGrid (apiKey, host, globalHeaders) { var client = new Client(globalRequest) this.emptyRequest = function () { - return require('sendgrid-rest').emptyRequest + return JSON.parse(JSON.stringify(require('sendgrid-rest').emptyRequest)); } // Interact with the API with this function |