-
Notifications
You must be signed in to change notification settings - Fork 23
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
Full implementation of xhr.responseType, rigorous test and a perf imp… #16
Conversation
…. When the default xhr.responseType we only set xhr.responseText. To get the desired xhr.response we need to separately GET with xhr.responseType='arraybuffer'.
Thanks for this! Looking at the scope of the changes I think I'll need some time to review it. |
…e as well as xhr.responseText
Hey @mjwwit, would appreciate you re-reviewing this patch as well when you get a chance. I've gotten Paul to apply your feedback, and got added as a contributor to his fork & his blessing to take over applying any additional changes the branch may need. Thanks! |
This PR is huge, and it's been too long since I last looked at it. It will take me significantly longer to review than the previous 2. |
There's still lots of ES2015 code in here (
The first option will require a possibly significant amount of work on your side, the second will delay the release of this code. I'm not yet sure how much time I'll need for the refactor, however. As I'm not sure how high the need for this functionality is, I'll leave the decision to you. |
Hey! Sorry for delay, OS bricked and spent the weekend repairing it (there are two types of people in this world, those that have a backup of all their data and those that will. I've just made that transition...), fun times. I would like this in, I'll get to refactoring when I get a moment, hope to get it up within a couple days from now for you. Though after reading the XHR spec a lot over the last week this package is quite far behind, and I would be down to help out any way you'd like in updating the module in the future, let me know! |
Okay. I found that the oldest node version that currently worked was node 4, with earlier versions throwing on an |
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.
I'll release this as a major update, to be on the safe side as I'm not entirely sure we're not breaking previous behavior.
I couldn't get the keepalive test to run under Node.js 4 because of API changes, but even when changing the test to use Node.js 4 compatible API I couldn't get it to work. It's not the server, as I tried running that separately using Node.js 22 and it still wouldn't pass. None of this is really related to this PR other than that I've had to increase the minimum supported Node.js version to 12 (as this is the first version that passes the keepalive test). I hope this is no problem for you. |
That works for me, thanks! |
…rovement.
Implemented section 3.6, subsections 8,9,10,11 of https://xhr.spec.whatwg.org/#the-response-attribute.
The test: test-response-type.js excerises it well.
Basically async download looks like this:
In order to use xhr.responseType="document" the npm package "@xmldom/xmldom" needs to be installed.
There's also been a perf improvement (new test: test-perf.js ):