Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix-missing-request-url in response (#183)
* codejedi365-fix-missing-url > add unit tests \### Rationale Define unit tests to highlight that there is an issue with the current code definition. 1 Test is just to mirror all other tests of setting the value of the responseURL and the other is to show that the url is being set to late to be usable. * codejedi365-fix-missing-url > fix bug in fake-xhr \### Rationale Switched the order of when the responseURL is defined to be at a minimum before `setResponseBody()`. `setResponseBody()` initiates the `readyStateChange()` which follows on to call the onload function and return the data to the xhr request handler all before returning to the respond function to set the url. At this point, it became too late. On the other side, when using `fetch()` to send the xhr request that `nise` then intercepts, the `fetch()` command returns the data to the response handler/resolves the promise during the `onload` event. Therefore, sinon js did not imitate real browser response which would contain the url. This fix resolves that mismatch. * codejedi365-fix-missing-url > prettier applied
- Loading branch information