Skip to content

Commit

Permalink
Pass http verb to the hook
Browse files Browse the repository at this point in the history
PR-URL: #308
  • Loading branch information
tshemsedinov committed May 16, 2022
1 parent 0747d46 commit 4d2f15d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased][unreleased]

- Pass http verb to the hook

## [2.0.7][] - 2022-05-09

- Fix client to support falsy results parsing
Expand Down
8 changes: 5 additions & 3 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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;
Expand Down

0 comments on commit 4d2f15d

Please sign in to comment.