-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
Handle XHR response error #137
Conversation
lib/proto/handle-response.js
Outdated
module.exports = function(responseText, request, href) { | ||
// Fail if unable to load HTML via AJAX | ||
if (responseText === false) { | ||
var tempOptions = this.options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be tempOptions = clone(this.options)
, or you'll mutate the current instance's options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
lib/proto/handle-response.js
Outdated
this.loadContent(responseText, this.options) | ||
} | ||
catch (e) { | ||
var tempOptions2 = this.options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to clone this.options
, but you could probably just do this once at the top of the method rather than repeating the assignment of the request to your temporary event options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
It's all looking good to me now, do you want to add some tests for |
Yes, please. You're better at that than I am. |
I don't have much time to do that at present, unfortunately, so you can either have a go yourself or, as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding tests, I'll try and find some time to review them shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a look at the tests this morning, all seems good to merge to me!
Fixes #123.