Openwhisk proxy (#147)

* implement proxy for needle to pass-thru openwhisk sdk
* Added unit test to verify the proxy options using proxy-agent
diff --git a/README.md b/README.md
index c0cdf52..29f8c5d 100644
--- a/README.md
+++ b/README.md
@@ -131,6 +131,16 @@
 ow.actions.invoke({ noUserAgent: true, name, params })
 ```
 
+### Working with a Proxy
+
+ If you are working behind a firewall, you could use the following environment variables to proxy your HTTP/HTTPS requests
+
+ - *http_proxy/HTTP_PROXY*
+- *https_proxy/HTTPS_proxy*
+
+ The openwhisk-client-js SDK supports the use of above mentioned proxies through third-party 
+ HTTP agent such as [proxy-agent](https://github.com/TooTallNate/node-proxy-agent "proxy-agent Github page")
+
 ## Examples
 
 ### invoke action, blocking for result
diff --git a/lib/client.js b/lib/client.js
index 488e363..ee797fc 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -8,7 +8,7 @@
 const needle = require('needle')
 const url = require('url')
 const http = require('http')
-
+const ProxyAgent = require('proxy-agent')
 /**
  * This implements a request-promise-like facade over the needle
  * library. There are two gaps between needle and rp that need to be
@@ -36,6 +36,18 @@
   // this situation than needle
   opts.json = true
 
+  // gather proxy settings if behind a firewall
+  var proxyUri = process.env.proxy ||
+      process.env.HTTP_PROXY ||
+      process.env.http_proxy ||
+      process.env.HTTPS_PROXY ||
+      process.env.https_proxy
+
+  if (proxyUri !== undefined) {
+    // set the agent with corresponding proxy
+    opts.agent = new ProxyAgent(proxyUri)
+  }
+
   return needle(opts.method.toLowerCase(), // needle takes e.g. 'put' not 'PUT'
     opts.url,
     opts.body || opts.params,
diff --git a/package.json b/package.json
index c382673..e7b596c 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,8 @@
     "standard": "^11.0.1"
   },
   "dependencies": {
-    "needle": "^2.1.0"
+    "needle": "^2.1.0",
+    "proxy-agent": "^3.0.3"
   },
   "babel": {
     "presets": [
diff --git a/test/unit/client.test.js b/test/unit/client.test.js
index c79cfb5..00ba2f0 100644
--- a/test/unit/client.test.js
+++ b/test/unit/client.test.js
@@ -6,6 +6,7 @@
 const test = require('ava')
 const Client = require('../../lib/client')
 const http = require('http')
+const ProxyAgent = require('proxy-agent')
 
 test('should use default constructor options', t => {
   const client = new Client({api_key: 'aaa', apihost: 'my_host'})
@@ -137,6 +138,22 @@
   t.deepEqual(params.b, {bar: 'foo'})
 })
 
+test('should be able to use proxy options leveraging the proxy agent.', async t => {
+  process.env['proxy'] = 'http://some_proxy'
+  const client = new Client({api_key: 'username:password', apihost: 'blah'})
+  const METHOD = 'get'
+  const PATH = 'some/path/to/resource'
+  const OPTIONS = {agent: new ProxyAgent(process.env['proxy'])}
+
+  const params = await client.params(METHOD, PATH, OPTIONS)
+  t.is(params.method, METHOD)
+  t.true(params.json)
+  t.true(params.rejectUnauthorized)
+  t.true(params.headers.hasOwnProperty('Authorization'))
+  t.deepEqual(params.agent.proxyUri, 'http://some_proxy')
+  delete process.env['proxy']
+})
+
 test('should return request parameters with explicit api option', async t => {
   const client = new Client({api_key: 'username:password', api: 'https://api.com/api/v1'})
   const METHOD = 'get'