mjwwit / node-XMLHttpRequest

XMLHttpRequest for node.js
http://thedanexperiment.com/2009/10/04/emulating-xmlhttprequest-in-node-js/
MIT License
15 stars 24 forks source link

Use response.setEncoding() only if the function exists in response #3

Closed jussikinnula closed 8 years ago

jussikinnula commented 8 years ago

With NodeJS 6 + Angular 2 + Socket.io, there's a case that response doesn't have setEncoding function set. To fix that just add simple check if response exists with the setEncoding property.

The problem can be tested with this app (by removing the hotfixes): https://github.com/jussikinnula/angular2-socketio-chat-example

mjwwit commented 8 years ago

Thanks! Looks good, merging.

mjwwit commented 8 years ago

I just published 1.5.3 on npm. Your fix is included.