diff --git a/lib/restler.js b/lib/restler.js index 4e8e9ea..74bd41f 100644 --- a/lib/restler.js +++ b/lib/restler.js @@ -137,7 +137,9 @@ mixin(Request.prototype, { } else { var body = ''; - response.setEncoding('binary'); + // When using browserify, response.setEncoding is not defined + if (typeof response.setEncoding == 'function') + response.setEncoding('binary'); response.on('data', function(chunk) { body += chunk;