-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
add arrayBuffer/Blob support to httpDo. implement loadBytes #2771
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
ugh. this test only fails on travis. i can't tell why... |
there seems to be an issue with the mocha test framework where an Error thrown in an inner Promise causes the test to fail rather than be caught in the outer Promise's catch clause. disabling this 404 test for now... also, this doesn't seem to happen on Windows, just on linux. |
Looks great, I'll check it out later this week and maybe have a crack at the mocha problem as well, weird that it differs between windows and linux though... |
yeah, i'm not really sure how to debug this, since it only happens within PhantomJS, not in the browser. I tried forcing the Promise polyfill in the browser, but it still didn't repro the problem. |
Ok, I've tested all that I can think of and here are a few points: Not sure why I didn't caught this before (maybe because I switched to Firefox recently) but if an error callback isn't provided, simply throwing the returned error will in Firefox cause it to fail silently while in Chrome and Safari cause it to throw an "Unhandled Promise Rejection" error. For some context of why see this question https://stackoverflow.com/questions/30715367/why-can-i-not-throw-inside-a-promise-catch-handler#30741722 The suggested method in the question using Next is about the mocha problem which I think I figured out. It seems that webkit haven't implement The rest may not be best for here as they are more general feature request, I can move it to a separate issue once this is merge.
Once the first two points are checked off this can be merged. |
Fantastic! I'll switch to ’console.error’ and workaround the missing finally. |
Excellent, thanks! |
re: #2693, closes #2674.
this PR adds
arrayBuffer
andBlob
support to thehttpDo
method, and adds a convenience methodloadBytes
for loading aUint8Array
specifically.adds some tests for
loadBytes
, including one for ensuring that the error callback is called when a 404 occurs.