Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[api] Added proxy support and improved uri path

  • Loading branch information...
commit 864c884c29f7392b2e18801060b2bd1cfb698f6d 1 parent 29c6eaf
Pavan Kumar Sunkara pksunkara authored

Showing 1 changed file with 12 additions and 7 deletions. Show diff stats Hide diff stats

  1. +12 7 lib/director-reflector.js
19 lib/director-reflector.js
... ... @@ -1,20 +1,27 @@
1 1 var client = exports,
2 2 utile = require('utile'),
3   - traverse = require('traverse');
  3 + traverse = require('traverse'),
  4 + request = require('request');
4 5
5 6 client.Client = function (options) {
6 7 var self = this;
7 8
8 9 options = options || {};
9 10
10   - options.port = options.port || 8000;
11   - options.host = options.host || "localhost";
12   - self.basePath = "http://" + options.host + ':' + options.port;
  11 + if (!options.uri) {
  12 + options.port = options.port || 8000;
  13 + options.host = options.host || "localhost";
  14 + self.basePath = "http://" + options.host + ':' + options.port;
  15 + } else {
  16 + self.basePath = options.uri;
  17 + }
13 18
14 19 if(typeof options.username !== "undefined" && typeof options.password !== "undefined") {
15 20 self.authorization = utile.base64.encode(options.username + ':' + options.password);
16 21 }
17 22
  23 + request.defaults({ proxy: options.proxy });
  24 +
18 25 return self;
19 26 }
20 27
@@ -91,8 +98,6 @@ client.id = function (id) {
91 98 return function(){};
92 99 }
93 100
94   -var request = require('request');
95   -
96 101 client.Client.prototype.request = function (path, verbs, args) {
97 102
98 103 var self = this;
@@ -214,4 +219,4 @@ client.toJSON = function (router) {
214 219 }
215 220 }
216 221 return JSON.stringify({ routes: _routes });
217   -};
  222 +};

0 comments on commit 864c884

Please sign in to comment.
Something went wrong with that request. Please try again.