File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const { tspl } = require ( '@matteo.collina/tspl' )
4
3
const { describe, test } = require ( 'node:test' )
5
4
const { FormData, Response } = require ( '..' )
6
5
7
6
describe ( 'https://github.com/nodejs/undici/issues/2283' , ( ) => {
8
7
test ( 'preserve full type when parsing multipart/form-data' , async ( t ) => {
9
- t = tspl ( t , { plan : 2 } )
10
8
const testBlob = new Blob ( [ '123' ] , { type : 'text/plain;charset=utf-8' } )
11
9
const fd = new FormData ( )
12
10
fd . set ( 'x' , testBlob )
13
11
const res = new Response ( fd )
14
- res . clone ( ) . text ( ) . then ( body =>
15
- // Just making sure that it contains ;charset=utf-8
16
- t . ok ( body . includes ( 'text/plain;charset=utf-8' ) )
17
- )
18
12
19
- new Response ( fd ) . formData ( ) . then ( fd => {
20
- // returns just 'text/plain'
21
- t . ok ( fd . get ( 'x' ) . type === 'text/plain;charset=utf-8' )
22
- } )
13
+ const body = await res . clone ( ) . text ( )
23
14
24
- await t . completed
15
+ // Just making sure that it contains ;charset=utf-8
16
+ t . assert . ok ( body . includes ( 'text/plain;charset=utf-8' ) )
17
+
18
+ const formData = await new Response ( fd ) . formData ( )
19
+
20
+ // returns just 'text/plain'
21
+ t . assert . ok ( formData . get ( 'x' ) . type === 'text/plain;charset=utf-8' )
25
22
} )
26
23
} )
You can’t perform that action at this time.
0 commit comments