Browse Source

Exposed http options object.

pull/53/head
Artūrs Vaļenieks 9 years ago
parent
commit
3d990c5643
2 changed files with 6 additions and 3 deletions
  1. +4
    -2
      lib/client.js
  2. +2
    -1
      package.json

+ 4
- 2
lib/client.js View File

@ -3,6 +3,7 @@ var https = require("https");
var json = require("./json"); var json = require("./json");
var url = require("url"); var url = require("url");
var util = require("util"); var util = require("util");
var _ = require('lodash');
/*section: client /*section: client
*comment: | *comment: |
@ -15,6 +16,7 @@ var client = function(){
this.api_key = null; this.api_key = null;
this.app_key = null; this.app_key = null;
this.proxy_agent = null; this.proxy_agent = null;
this.http_options = null;
this.api_version = "v1"; this.api_version = "v1";
this.api_host = "app.datadoghq.com"; this.api_host = "app.datadoghq.com";
}; };
@ -66,12 +68,12 @@ client.prototype.request = function(method, path, params, callback){
"query": query, "query": query,
}); });
var http_options = {
var http_options = _.assign({
hostname: this.api_host, hostname: this.api_host,
port: 443, port: 443,
method: method.toUpperCase(), method: method.toUpperCase(),
path: path path: path
};
}, this.http_options);
if(this.proxy_agent){ if(this.proxy_agent){
http_options["agent"] = this.proxy_agent; http_options["agent"] = this.proxy_agent;


+ 2
- 1
package.json View File

@ -35,7 +35,8 @@
"extend": "^3.0.0", "extend": "^3.0.0",
"json-bigint": "^0.1.4", "json-bigint": "^0.1.4",
"minimist": "^1.1.1", "minimist": "^1.1.1",
"rc": "^1.0.0"
"rc": "^1.0.0",
"lodash": "latest"
}, },
"devDependencies": { "devDependencies": {
"bignumber.js": "^2.0.7", "bignumber.js": "^2.0.7",


Loading…
Cancel
Save