From: Jason Woofenden Date: Mon, 11 Feb 2013 21:50:39 +0000 (-0500) Subject: json_request always pass response, even if empty X-Git-Url: https://jasonwoof.com/gitweb/?p=af-coffee.git;a=commitdiff_plain;h=36afa8a844f8dc9fc50bf6ee4da3fc55e900d9b1 json_request always pass response, even if empty --- diff --git a/api.coffee b/api.coffee index 318531f..156e91c 100644 --- a/api.coffee +++ b/api.coffee @@ -142,8 +142,8 @@ json_request = (method, path, data, token, callback) -> data = JSON.stringify data request method, path, 'application/json', data, token, (err, response) -> return callback err if err - return callback() if response is ' ' - return callback() if response is '' + return callback null, '' if response is ' ' + return callback null, '' if response is '' try callback null, JSON.parse(response) catch error