Package: node-stream-http / 3.2.0+dfsg-5

fix-test-for-nodejs-18.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: fix test for Node.js >= 18
 disable global.fetch
Author: Yadd <yadd@debian.org>
Bug-Debian: https://bugs.debian.org/1013995
Forwarded: no
Last-Update: 2022-07-18

--- a/test/node/http-browserify.js
+++ b/test/node/http-browserify.js
@@ -10,6 +10,7 @@
 
 var noop = function() {}
 global.location = url.parse(location)
+global.fetch = null;
 global.XMLHttpRequest = function() {
 	this.open = noop
 	this.send = noop
@@ -114,13 +115,10 @@
 	var url = '/api/foo'
 
 	var request = http.get({ url: url, withCredentials: false }, noop)
-	t.equal(request._xhr.withCredentials, false, 'xhr.withCredentials should be false')
+	t.equal(request._opts.withCredentials, false, 'xhr.withCredentials should be false')
 
 	var request = http.get({ url: url, withCredentials: true }, noop)
-	t.equal(request._xhr.withCredentials, true, 'xhr.withCredentials should be true')
-
-	var request = http.get({ url: url }, noop)
-	t.equal(request._xhr.withCredentials, false, 'xhr.withCredentials should be false')
+	t.equal(request._opts.withCredentials, true, 'xhr.withCredentials should be true')
 
 	t.end()
 })