-
Notifications
You must be signed in to change notification settings - Fork 26
sync policy, MIME override, encoding support, and more #31
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
Conversation
|
A few note on this: Since We can either increase the minimum node version limit or change to use an external dependency for decoding (such as |
|
At first glance this looks really solid, thanks for the great work! ❤️
I have no problems raising the minimum version to 13 or 14. |
|
I have no idea if we can keep the minimum version as v12, with caveats that encoding won't work with many options and need to specify a custom decoder ( Please let me know what you think about this. |
Keeping the minimum version with caveats is probably a bad idea. People will probably not read about these caveats proactively, and the package won't be fully functional on Node.js 12. I'll make the next release a major. People can still choose not to upgrade because of that. |
|
alright, that sounds good for me too 👍 |
mjwwit
left a comment
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.
Looking good! The syncPolicy "disabled" behavior contains a bug though; when sending an async request it still throws an error. Maybe this would also be a good candidate for a test.
…d basic anti-pollution measure
|
I've fixed the problems you addressed, and went further and added a basic measure to anti-prototype pollution, there is also a new test i added for that purpose ( |
|
It looks complete now, I'll run some usage tests to see if I can discover any problems. I'm not expecting to find anything, so I'll probably merge quickly after that. The release will follow shortly after that, probably on the same day. |
|
Alright, all sounds good to me 👍 |
|
Thanks again for the solid work ❤️. I've released it as version 4.0.0. |
Synchronous policy and fixes
syncPolicy: "warn" | "enabled" | "disabled"(default is "warn") to explicitly enable/disable synchronous XHR with or without warning"warn": enable synchronous xhr but shows a warning when the user attempts to callxhr.open()with sync flag:"enabled": enable synchronous xhr, no warnings"disabled": disable synchronous, callingxhr.open()with sync flag won't show any warning, but an exception is thrown when callingxhr.send()afterwards:.responseencoding error when.responseTypeis "arraybuffer" and synchronous #29)Encoding and MIME type support
xhr.overrideMimeType(type)(Missing overrideMimeType method #27)Content-Typeheader or through user's custom encoding viaxhr.overrideMimeType())Non-standard methods
xhr.setDisableHeaderCheck()and instead added a non-standarddisableHeaderCheck: true | false(default isfalse)xhr.getRequestHeader():Others
XMLHttpRequestto be called withoutnewoperatorcreateFileOrSyncResponseandcreateResponseinto one methodcreateResponsereadyStatevalue)XMLHttpRequestand any newly-created xhr objecttextDecoder: <func>for users to specify custom text decoder (to support more range of encodings for old Node versions) andxmlParser: <func>to support parsing forxhr.responseXML