You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2018/07/18 13:58:33 UTC
[couchdb-nano] 03/08: add default parameter value in responseHandler
This is an automated email from the ASF dual-hosted git repository.
glynnbird pushed a commit to branch issue98
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git
commit 2e849923b4b0380e3ed74c0311340abf5acfd451
Author: Glynn Bird <gl...@gmail.com>
AuthorDate: Wed Jul 18 13:26:48 2018 +0100
add default parameter value in responseHandler
---
lib/nano.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/nano.js b/lib/nano.js
index e0384cb..f911b6f 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -69,12 +69,12 @@ module.exports = exports = nano = function dbScope(cfg) {
}
const responseHandler = function(req, opts, resolve, reject, callback) {
- return function(err, response, body) {
+ return function(err, response = { statusCode: 500 }, body) {
let parsed;
const responseHeaders = Object.assign({
uri: req.uri,
- statusCode: response ? response.statusCode : 500
- }, response ? response.headers : {});
+ statusCode: response.statusCode
+ }, response.headers);
if (err) {
log({err: 'socket', body: body, headers: responseHeaders});
const ret_e = errs.merge(err, {