Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery 1.x with passthrough #85

Closed
code0100fun opened this issue Jul 24, 2015 · 7 comments
Closed

jQuery 1.x with passthrough #85

code0100fun opened this issue Jul 24, 2015 · 7 comments
Assignees

Comments

@code0100fun
Copy link

I can't get passthrough to work with jQuery 1.x. The requests are sent using $.ajax('/path').then(...) but the then callbacks are never fired.

Seems like the onload event is detected on the browser xhr but is not supported by the 1.x jQuery xhr module, so it is not dispatched when the response is received.

I was able to get the events to fire by removing the check for onload and just adding both events.

There is a chance that both events could be fired I'm guessing. Any other concerns I should check into before getting a PR ready?

@trek
Copy link
Member

trek commented Aug 2, 2015

Seems bad. PR would be help.

@kottenator
Copy link

I'm using jQuery 1.11.3 too and unfortunately I can't switch to jQuery 2.x :(
Could you (Pretender developers), please, check jQuery 1.x support?

@olivierlesnicki
Copy link
Contributor

@trek any update on this one?

@olivierlesnicki
Copy link
Contributor

@code0100fun do you have a PR for this one?

@code0100fun
Copy link
Author

I can't think of a clean way to tell when the user has an older version of jQuery without tying Pretender to jQuery in some way.

As a workaround, you may be able to wrap the onload callback of FakeXMLHTTPRequest and call onreadystatechange. That is what jQuery 1.x is using as a success callback.

It looks like onreadystatechange is supposed to be called according to the spec. Maybe FakeXMLHTTPRequest should be calling _readyStateChange here, but I'm not very familiar with the internals.

Any advice @trek or @mike-north ?

@olivierlesnicki
Copy link
Contributor

@code0100fun this is what i've done: #114

@trek
Copy link
Member

trek commented Dec 11, 2015

addressed by #130

@trek trek closed this as completed Dec 11, 2015
jeremy-w added a commit to jeremy-w/mirage-xhr-hanging-repro that referenced this issue Jul 13, 2016
The app this is based on originally used an older Mirage.
The npm dependencies were updated to the newer, but not the bower.

It was hoped this would fix the issue by incorporating the fix
for pretenderjs/pretender#85
via pretenderjs/pretender#130
as part of the move past Pretender version 0.11.0
(https://github.com/pretenderjs/pretender/blob/master/CHANGELOG.md#0110),
but, surprisingly, that did *not* fix the issue.

Well, this is frustrating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants