Skip to content
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

Fix TypeError: t.body is null #126

Open
garronej opened this issue Oct 9, 2023 · 0 comments
Open

Fix TypeError: t.body is null #126

garronej opened this issue Oct 9, 2023 · 0 comments

Comments

@garronej
Copy link

garronej commented Oct 9, 2023

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Problem started to arise with empty response body with latest version of Firefox (I think).

Here is the diff that solved my problem:

diff --git a/node_modules/stream-http/lib/response.js b/node_modules/stream-http/lib/response.js
index 91d1900..aeab6b3 100644
--- a/node_modules/stream-http/lib/response.js
+++ b/node_modules/stream-http/lib/response.js
@@ -75,6 +75,12 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, r
 				return
 			} catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this
 		}
+
+		if (!response.body) {
+			resetTimers(true);
+			self.push(null)
+			return
+		}
 		// fallback for when writableStream or pipeTo aren't available
 		var reader = response.body.getReader()
 		function read () {

Update of: #110

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant