From 821d9ac15903ca29e0a06851f5ef2c689490b483 Mon Sep 17 00:00:00 2001 From: Bojan Djurkovic Date: Wed, 28 Dec 2016 17:01:23 -0400 Subject: [PATCH] safer call to client request --- lib/build.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/build.js b/lib/build.js index dd22274..0d479e8 100644 --- a/lib/build.js +++ b/lib/build.js @@ -94,7 +94,11 @@ Builder.prototype.buildAction = function (action) { } this.client = this.base; - return this.client.request(action.method, requestPath, data, fn); + if (fn) { + return this.client.request(action.method, requestPath, data, fn); + } else { + return this.client.request(action.method, requestPath, data); + } } constructor.prototype[getName(actionName)] = function (data, fn) {