From 3a178a574411f03120b89c2771bf2217fe063bd0 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Wed, 15 Mar 2017 16:25:44 -0700 Subject: [PATCH] Avoid crash when missing connection request creds --- lib/api-functions.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api-functions.coffee b/lib/api-functions.coffee index a1b4ed0..956bf13 100644 --- a/lib/api-functions.coffee +++ b/lib/api-functions.coffee @@ -78,10 +78,10 @@ httpConReq = (url, username, password, timeout, callback) -> if res.statusCode == 401 and res.headers['www-authenticate']? authHeader = auth.parseAuthHeader(res.headers['www-authenticate']) if authHeader.method is 'Basic' - options.headers = {'Authorization' : auth.basic(username, password)} + options.headers = {'Authorization' : auth.basic(username or '', password or '')} else if authHeader.method is 'Digest' options.headers = { - 'Authorization' : auth.digest(username, password, options.path, 'GET', null, authHeader) + 'Authorization' : auth.digest(username or '', password or '', options.path, 'GET', null, authHeader) } request = http.get(options, (res) ->