File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const { test } = require ( 'tap' )
4
- const { FormData, File } = require ( '../../' )
4
+ const { FormData, File, Response } = require ( '../../' )
5
5
const { Blob : ThirdPartyBlob } = require ( 'formdata-node' )
6
6
const { Blob } = require ( 'buffer' )
7
7
@@ -296,3 +296,22 @@ test('arguments', (t) => {
296
296
297
297
t . end ( )
298
298
} )
299
+
300
+ // https://github.com/nodejs/undici/pull/1814
301
+ test ( 'FormData returned from bodyMixin.formData is not a clone' , async ( t ) => {
302
+ const fd = new FormData ( )
303
+ fd . set ( 'foo' , 'bar' )
304
+
305
+ const res = new Response ( fd )
306
+ fd . set ( 'foo' , 'foo' )
307
+
308
+ const fd2 = await res . formData ( )
309
+
310
+ t . equal ( fd2 . get ( 'foo' ) , 'bar' )
311
+ t . equal ( fd . get ( 'foo' ) , 'foo' )
312
+
313
+ fd2 . set ( 'foo' , 'baz' )
314
+
315
+ t . equal ( fd2 . get ( 'foo' ) , 'baz' )
316
+ t . equal ( fd . get ( 'foo' ) , 'foo' )
317
+ } )
You can’t perform that action at this time.
0 commit comments