Closed boggan closed 7 years ago
Heh, I was just going to send a PR that partially overlaps with this one :)
lol perfect timing I guess :)
I've submitted mine anyway just to demonstrate an alternative approach and let the lib owner decide :)
On Thu, Feb 2, 2017 at 5:24 PM boggan notifications@github.com wrote:
lol perfect timing I guess :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jameslnewell/xhr-mock/pull/16#issuecomment-276970994, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgGCDtRJGHUC576wov8OoiuKgblqUVkks5rYecEgaJpZM4L0Hzv .
Thanks for the PR! Can you please work with @emirotin on the common functionality.
If you want to move the other features to their own PR I'll merge them in the mean time.
Then let's merge my PR and then you'll drop parts of yours and rebase it to keep the other parts you still find relevant? P.S. Sorry for the delayed answer
On Fri, Feb 3, 2017 at 5:50 PM boggan notifications@github.com wrote:
@boggan commented on this pull request.
In index.js https://github.com/jameslnewell/xhr-mock/pull/16:
@@ -41,7 +46,7 @@ module.exports = { var handler; if (arguments.length === 3) { handler = function(req, res) {
- if (req.method() === method && req.url() === url) {
- if (req.method() === method && req.url() === _getBaseUrl(url)) {
It think @emirotin https://github.com/emirotin's approach is best, I realised I needed to change my URL matching to use a regexp to extract parts to of some REST API calls.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jameslnewell/xhr-mock/pull/16, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgGCH0qKfz9sa6YWKLjj40A1JK3Qg_hks5rYz7DgaJpZM4L0Hzv .
I've added support for calling .send()
with async=false
in xhr-mock@2.0.0-preview.2
. I haven't extensively tested it so please open an issue if it doesn't work for your usage.
The rest of the features have already made their way into the library.
MockRequest.js
MockXMLHttpRequest.js
index.js