diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 20:56:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-21 20:56:19 +0000 |
commit | 0b6210cd37b68b94252cb798598b12974a20e1c1 (patch) | |
tree | e371686554a877842d95aa94f100bee552ff2a8e /test/fetch/bundle.js | |
parent | Initial commit. (diff) | |
download | node-undici-upstream.tar.xz node-undici-upstream.zip |
Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3.upstream/5.28.2+dfsg1+_cs23.11.12.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/fetch/bundle.js')
-rw-r--r-- | test/fetch/bundle.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/fetch/bundle.js b/test/fetch/bundle.js new file mode 100644 index 0000000..aa1257a --- /dev/null +++ b/test/fetch/bundle.js @@ -0,0 +1,41 @@ +'use strict'
+
+const { test, skip } = require('tap')
+const { nodeMajor } = require('../../lib/core/util')
+
+if (nodeMajor === 16) {
+ skip('esbuild uses static blocks with --keep-names which node 16.8 does not have')
+ process.exit()
+}
+
+const { Response, Request, FormData, Headers } = require('../../undici-fetch')
+
+test('bundle sets constructor.name and .name properly', (t) => {
+ t.equal(new Response().constructor.name, 'Response')
+ t.equal(Response.name, 'Response')
+
+ t.equal(new Request('http://a').constructor.name, 'Request')
+ t.equal(Request.name, 'Request')
+
+ t.equal(new Headers().constructor.name, 'Headers')
+ t.equal(Headers.name, 'Headers')
+
+ t.equal(new FormData().constructor.name, 'FormData')
+ t.equal(FormData.name, 'FormData')
+
+ t.end()
+})
+
+test('regression test for https://github.com/nodejs/node/issues/50263', (t) => {
+ const request = new Request('https://a', {
+ headers: {
+ test: 'abc'
+ },
+ method: 'POST'
+ })
+
+ const request1 = new Request(request, { body: 'does not matter' })
+
+ t.equal(request1.headers.get('test'), 'abc')
+ t.end()
+})
|