jameslnewell / xhr-mock

Utility for mocking XMLHttpRequest.
196 stars 48 forks source link

send() only accepts string? #53

Closed marcell-calero closed 6 years ago

marcell-calero commented 6 years ago

Why does an error fire if we put a string in the send ()? Is not it better to leave the body empty and follow? Or maybe to put a flag that does not need to put a string

jameslnewell commented 6 years ago

Hi Marcell, thanks for raising an issue. xhr.send() should accept a string, but one of your mocks might be throwing an error and that will trigger xhr.onerror. At the moment debugging an error thrown in a handler is quite painful (its impossible to get the actual error out of the xhr object) but I'm working on improving the experience in the next version of xhr-mock.

If you can provide a working snippet that showcases the error I can help you debug what's going wrong.

jameslnewell commented 6 years ago

Closing due to the lack of a response.