diff --git a/CHANGELOG.md b/CHANGELOG.md index 19d4a560..9172dd23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased][unreleased] +## [2.0.8][] - 2022-05-17 + +- Pass http verb to the hook + ## [2.0.7][] - 2022-05-09 - Fix client to support falsy results parsing @@ -185,7 +189,8 @@ Module stub v0.0.0 and all before 1.0.0 are experiments with syntactic and binary structures and multiple different ideas originated from JSTP and old protocols like USP and CLEAR. -[unreleased]: https://github.com/metarhia/metacom/compare/v2.0.7...HEAD +[unreleased]: https://github.com/metarhia/metacom/compare/v2.0.8...HEAD +[2.0.8]: https://github.com/metarhia/metacom/compare/v2.0.7...v2.0.8 [2.0.7]: https://github.com/metarhia/metacom/compare/v2.0.6...v2.0.7 [2.0.6]: https://github.com/metarhia/metacom/compare/v2.0.5...v2.0.6 [2.0.5]: https://github.com/metarhia/metacom/compare/v2.0.4...v2.0.5 diff --git a/lib/http.js b/lib/http.js index 3b67c48e..c5843a2d 100644 --- a/lib/http.js +++ b/lib/http.js @@ -118,8 +118,9 @@ class HttpChannel extends Channel { res.end(); } - async hook(proc, interfaceName, methodName, args) { - const { application, client } = this; + async hook(proc, interfaceName, methodName, args, headers) { + const { application, client, req } = this; + const verb = req.method; const callId = -1; if (!proc) { this.error(404, { callId }); @@ -128,7 +129,8 @@ class HttpChannel extends Channel { const context = { client }; let result = null; try { - result = await proc.invoke(context, { method: methodName, args }); + const par = { verb, method: methodName, args, headers }; + result = await proc.invoke(context, par); } catch (error) { this.error(500, { callId, error }); return; diff --git a/package-lock.json b/package-lock.json index 90f53f45..2bf526eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "metacom", - "version": "2.0.7", + "version": "2.0.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cfc2ed06..11adc284 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metacom", - "version": "2.0.7", + "version": "2.0.8", "author": "Timur Shemsedinov ", "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access", "license": "MIT",