diff --git a/legacy/router.service.adapter.http.js b/legacy/router.service.adapter.http.js index c4b4aac..7e93c07 100644 --- a/legacy/router.service.adapter.http.js +++ b/legacy/router.service.adapter.http.js @@ -51,7 +51,7 @@ ServiceHTTPAdapter.prototype._buildURI = function (path, data) { return url.format(uri); }; -ServiceHTTPAdapter.prototype._request = function (method, path, data, body) { +ServiceHTTPAdapter.prototype._request = function (method, path, data, body, headers) { // add promise wrapper return when.promise(function (resolve, reject) { // ------------------------------------------------ @@ -59,7 +59,8 @@ ServiceHTTPAdapter.prototype._request = function (method, path, data, body) { method: method, uri: this._buildURI(path, data), body: body, - json: _.isObject(body) + json: _.isObject(body), + headers: headers || {} }, function (error, response, body) { if (error) { reject(error); @@ -87,15 +88,15 @@ ServiceHTTPAdapter.prototype._request = function (method, path, data, body) { /* --------------------------------------------------- * Public Functions * --------------------------------------------------- */ -ServiceHTTPAdapter.prototype.get = function (path, data) { - return this._request('GET', path, data); +ServiceHTTPAdapter.prototype.get = function (path, data, headers) { + return this._request('GET', path, data, null, headers); }; -ServiceHTTPAdapter.prototype.post = function (path, body) { - return this._request('POST', path, null, body); +ServiceHTTPAdapter.prototype.post = function (path, body, headers) { + return this._request('POST', path, null, body, headers); }; -ServiceHTTPAdapter.prototype.put = function (path, body) { - return this._request('PUT', path, null, body); +ServiceHTTPAdapter.prototype.put = function (path, body, headers) { + return this._request('PUT', path, null, body, headers); }; -ServiceHTTPAdapter.prototype.delete = function (path, data) { - return this._request('DELETE', path, data); +ServiceHTTPAdapter.prototype.delete = function (path, data, headers) { + return this._request('DELETE', path, data, null, headers); }; \ No newline at end of file diff --git a/lib/router.service.adapter.http.js b/lib/router.service.adapter.http.js index 2f64418..fec9b7a 100644 --- a/lib/router.service.adapter.http.js +++ b/lib/router.service.adapter.http.js @@ -51,15 +51,16 @@ ServiceHTTPAdapter.prototype._buildURI = function (path, data) { return url.format(uri); }; -ServiceHTTPAdapter.prototype._request = function (method, path, data, body) { +ServiceHTTPAdapter.prototype._request = function (method, path, data, body, headers) { // add promise wrapper return when.promise(function (resolve, reject) { // ------------------------------------------------ request({ - method: method, - uri: this._buildURI(path, data), - body: body, - json: _.isObject(body) + method: method, + uri: this._buildURI(path, data), + body: body, + json: _.isObject(body), + headers: headers || {} }, function (error, response, body) { if (error) { @@ -90,15 +91,15 @@ ServiceHTTPAdapter.prototype._request = function (method, path, data, body) { /* --------------------------------------------------- * Public Functions * --------------------------------------------------- */ -ServiceHTTPAdapter.prototype.get = function (path, data) { - return this._request('GET', path, data); +ServiceHTTPAdapter.prototype.get = function (path, data, headers) { + return this._request('GET', path, data, null, headers); }; -ServiceHTTPAdapter.prototype.post = function (path, body) { - return this._request('POST', path, null, body); +ServiceHTTPAdapter.prototype.post = function (path, body, headers) { + return this._request('POST', path, null, body, headers); }; -ServiceHTTPAdapter.prototype.put = function (path, body) { - return this._request('PUT', path, null, body); +ServiceHTTPAdapter.prototype.put = function (path, body, headers) { + return this._request('PUT', path, null, body, headers); }; -ServiceHTTPAdapter.prototype.delete = function (path, data) { - return this._request('DELETE', path, data); +ServiceHTTPAdapter.prototype.delete = function (path, data, headers) { + return this._request('DELETE', path, data, null, headers); }; diff --git a/package.json b/package.json index 898b302..96e3c40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyper.io", - "version": "0.6.6", + "version": "0.7.0", "description": "MicroServices so fast they've gone plaid!", "homepage": "https://github.com/jstty/hyper.io#readme", "keywords": [