cujojs / rest

RESTful HTTP client for JavaScript
http://cujojs.com/
Other
1k stars 146 forks source link

XHR sends string 'undefined' as request body in IE11 #178

Closed bhamme closed 5 years ago

bhamme commented 6 years ago

If the request given to the XHR client doesn't include an entity prop, xhr.js sends undefined to XMLHttpRequest.send which seems to change the content header if run in IE11. It seems like other libraries get around this by just checking for undefined and passing null instead: https://github.com/axios/axios/issues/248 https://github.com/aurelia/http-client/issues/41

Think xhr.js just needs to be modified to perform that check as well

entity = request.entity || null;
...
client.send(entity);

In the meantime the workaround is just to explicitly pass in a null entity in the request.

scothis commented 5 years ago

rest.js is no longer maintained