Skip to content

Commit e70709c

Browse files
committed
Merge pull request #162 from shaneneuerburg/master
Don't call response.setEncoding when it isn't defined
2 parents 754c328 + 4390203 commit e70709c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/restler.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ mixin(Request.prototype, {
137137
} else {
138138
var body = '';
139139

140-
response.setEncoding('binary');
140+
// When using browserify, response.setEncoding is not defined
141+
if (typeof response.setEncoding == 'function')
142+
response.setEncoding('binary');
141143

142144
response.on('data', function(chunk) {
143145
body += chunk;

0 commit comments

Comments
 (0)