Skip to content

Commit

Permalink
Merge pull request #162 from shaneneuerburg/master
Browse files Browse the repository at this point in the history
Don't call response.setEncoding when it isn't defined
  • Loading branch information
easternbloc committed Sep 29, 2015
2 parents 754c328 + 4390203 commit e70709c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/restler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e70709c

Please sign in to comment.