@@ -1353,32 +1353,32 @@ describe("client", () => {
1353
1353
} ) ;
1354
1354
} ) ;
1355
1355
1356
- it ( ' multipart/form-data with a file' , async ( ) => {
1357
- const TEST_STRING = ' Hello this is text file string' ;
1356
+ it ( " multipart/form-data with a file" , async ( ) => {
1357
+ const TEST_STRING = " Hello this is text file string" ;
1358
1358
1359
- const file = new Blob ( [ TEST_STRING ] , { type : ' text/plain' } ) ;
1359
+ const file = new Blob ( [ TEST_STRING ] , { type : " text/plain" } ) ;
1360
1360
const formData = new FormData ( ) ;
1361
- formData . append ( ' file' , file ) ;
1361
+ formData . append ( " file" , file ) ;
1362
1362
1363
1363
const client = createClient < paths > ( { baseUrl } ) ;
1364
- useMockRequestHandler ( {
1364
+ useMockRequestHandler ( {
1365
1365
baseUrl,
1366
1366
method : "post" ,
1367
1367
path : "/multipart-form-data-file-upload" ,
1368
- handler : async ( data ) => {
1368
+ handler : async ( data ) => {
1369
1369
// Get text from file and send it back
1370
1370
const formData = await data . request . formData ( ) ;
1371
- const text = await ( formData . get ( ' file' ) as File ) . text ( )
1372
- return new HttpResponse ( JSON . stringify ( { text} ) )
1371
+ const text = await ( formData . get ( " file" ) as File ) . text ( ) ;
1372
+ return new HttpResponse ( JSON . stringify ( { text } ) ) ;
1373
1373
} ,
1374
1374
} ) ;
1375
- const { data} = await client . POST ( "/multipart-form-data-file-upload" , {
1376
- // TODO: how to get this to accept FormData?
1375
+ const { data } = await client . POST ( "/multipart-form-data-file-upload" , {
1376
+ // TODO: how to get this to accept FormData?
1377
1377
body : formData as unknown as string ,
1378
- } )
1378
+ } ) ;
1379
1379
1380
- expect ( data ?. text ) . toBe ( TEST_STRING )
1381
- } )
1380
+ expect ( data ?. text ) . toBe ( TEST_STRING ) ;
1381
+ } ) ;
1382
1382
} ) ;
1383
1383
1384
1384
describe ( "responses" , ( ) => {
0 commit comments