jameslnewell / xhr-mock

Utility for mocking XMLHttpRequest.
196 stars 48 forks source link

Unimplemented error thrown from .responseXML precludes workarounds #72

Closed IanDavey closed 3 years ago

IanDavey commented 6 years ago

Suppose we have the following in onreadystatechange:

let result = this.responseXML || this.responseText || this.response;

As responseXML is not implemented, xhr-mock outputs the message This feature hasn't been implmented yet. Please submit an Issue or Pull Request on Github.

However, in the snippet above we have a workaround, as long as we're not expecting an XML Document in our tests. Rather than just returning undefined and making the code under test try responseText, the mock just gives up.

jameslnewell commented 5 years ago

Makes sense. Looks easy to implement. Want to have a crack at it?

K0d1Lu commented 4 years ago

I'm facing the same problem, could assign me this issue ?