Fixing XHR behavior

- Fix xhr error response
- Fix node.js XHR shim