stream-http icon indicating copy to clipboard operation
stream-http copied to clipboard

Prevented uncaught exception if body is null (fixes MS Edge `getReader` bug)

Open charlesfries opened this issue 6 years ago • 4 comments

charlesfries avatar Apr 10 '19 23:04 charlesfries

@jhiesey can you merge this pr ? I'm stuck like @charlesfries with this problem. Thank you

marinav avatar Nov 25 '19 16:11 marinav

Can you submit a unit test with this fix?

feross avatar May 05 '20 16:05 feross

This one is a bit difficult to submit a test fix with. Edge is now based on chrome and does not exercise this now, and haven't been able to get a copy of legacy edge on mac.

But that is not my problem. I am seeing body be undefined on a fetch in an android webview on a status 401, but can't quite get the test setup to duplicate it in these tests.

The fix is essentially a null check, low risk, and the proper way to test it would be via an actual unit test on the class, not getting express to do something a little funky in an integration test.

This current bug breaks the https://github.com/Yaffle/EventSource polyfill when it's used with the commonly used https://github.com/parshap/node-libs-react-native library that uses stream-http.

I would really rather you allowed this in. Thank you!!

truelson avatar Feb 09 '21 13:02 truelson

We have an app running in an Android webview and with the latest release last week of Chrome webview (113.0.5672.76) (any version we tested with a major version 113) we started having an issue with am unhandled promise exception

Unhandled Promise rejection: Cannot read properties of null (reading 'getReader') ; Zone: ; Task: Promise.then ; Value: TypeError:

We had no problems with any other versions of webview we tested with.

This change appears to have fixed our issue (found it after spending most of the day testing/debugging)

OpenSystemsConsulting avatar May 17 '23 07:05 OpenSystemsConsulting