reqwest
reqwest copied to clipboard
Pass status and XHR to success and complete handlers
Hi,
I needed to access the XHR object on my success handlers, so I added this quick hack. Is this the proper way to do it? Also, is there any reason it wasn't included from the start?
Thanks!
+1 for this.
@inf0rmer whydid you remove the IE JSONP hack? And.. you've edited the build file, reqwest.js and also the source file src/reqwest.js, you should only be editing the latter for your commits. Cheers.
Ah, about the IE thing, I must've screwed up the pull request. I only meant to commit the part relevant to the request title. It's unrelated to this issue, but I had to do that or otherwise JSONP requests would not work on IE10 (although that was on a beta version, but I needed it for a project at the time).
A similar excuse about pullrequesting the built file, that was a silly mistake. My first pull request, how much more wrong could it have gone? :P
Congrats on your first pull request! It's great that you decided to contribute to Reqwest.
Interesting news that JSONP is broken on IE10, I really need to sort out a Windows 8 machine now that IE10 is in the wild.
To fix the pull request, you can either make another commit to your master branch and it'll fix it up here (it's better to do a PR from a separate branch by the way so it's easier to avoid adding extraneous commits), or close this PR and open a new one with just the commit/changes you're proposing.
If you set the type to something non-existing, you get the original XHR object, see this example.
I also have a use case for the XHR object.
@ded Can we get something similar merged, JSONP hack for IE notwithstanding?