Skip to content

Commit

Permalink
request timeout support for umf messages (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjus authored May 17, 2017
1 parent d6da34e commit 85fb542
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,9 @@ class Hydra extends EventEmitter {
if (umfmsg.authorization) {
options.headers.Authorization = umfmsg.authorization;
}
if (umfmsg.timeout) {
options.timeout = umfmsg.timeout;
}
options.body = Utils.safeJSONStringify(umfmsg.body);
serverRequest.send(Object.assign(options, sendOpts))
.then((res) => {
Expand Down
8 changes: 7 additions & 1 deletion lib/umfmessage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const uuid = require('uuid');
const UMF_VERSION = 'UMF/1.4.4';
const UMF_VERSION = 'UMF/1.4.5';

/**
* @name UMFMessage
Expand Down Expand Up @@ -76,6 +76,9 @@ class UMFMessage {
if (this.message['rmid']) {
message['rmid'] = this.message['rmid'];
}
if (this.message['timeout']) {
message['tmo'] = this.message['timeout'];
}
if (this.message['timestamp']) {
message['ts'] = this.message['timestamp'];
}
Expand Down Expand Up @@ -144,6 +147,9 @@ function createMessageInstance(message) {
if (message.rmid) {
proxy.rmid = message.rmid;
}
if (message.timeout || message.tmo) {
proxy.timeout = message.timeout || message.tmo;
}
proxy.timestamp = message.timestamp || message.ts || proxy.getTimeStamp();
if (message.type || message.typ) {
proxy.type = message.type || message.typ;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydra",
"version": "1.3.11",
"version": "1.3.12",
"license": "MIT",
"author": "Carlos Justiniano",
"contributors": [
Expand Down

0 comments on commit 85fb542

Please sign in to comment.