11import assert from 'node:assert/strict'
22import { Buffer } from 'node:buffer'
3+ import { File } from 'node:buffer'
34import { createServer } from 'node:http'
45import { describe , it } from 'node:test'
56import { App } from '@tinyhttp/app'
@@ -353,7 +354,7 @@ describe('Multipart', () => {
353354 it ( 'should parse multipart with files' , async ( ) => {
354355 const fd = new FormData ( )
355356 const file = new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } )
356- fd . set ( 'file' , file )
357+ fd . set ( 'file' , file as Blob )
357358 const server = createServer ( async ( req : ReqWithBody < { file : [ File ] } > , res ) => {
358359 await multipart ( ) ( req , res , ( err ) => err && console . log ( err ) )
359360
@@ -380,8 +381,8 @@ describe('Multipart', () => {
380381 new File ( [ 'bye world' ] , 'bye.txt' , { type : 'text/plain' } )
381382 ]
382383
383- fd . set ( 'file1' , files [ 0 ] )
384- fd . set ( 'file2' , files [ 1 ] )
384+ fd . set ( 'file1' , files [ 0 ] as Blob )
385+ fd . set ( 'file2' , files [ 1 ] as Blob )
385386
386387 const server = createServer ( async ( req : ReqWithBody < { file1 : [ File ] ; file2 : [ File ] } > , res ) => {
387388 await multipart ( ) ( req , res , ( err ) => err && console . log ( err ) )
@@ -405,7 +406,7 @@ describe('Multipart', () => {
405406 it ( 'should support binary files' , async ( ) => {
406407 const fd = new FormData ( )
407408 const file = new File ( [ new Uint8Array ( [ 1 , 2 , 3 ] ) ] , 'blob.bin' , { type : 'application/octet-stream' } )
408- fd . set ( 'file' , file )
409+ fd . set ( 'file' , file as Blob )
409410
410411 const server = createServer ( async ( req : ReqWithBody < { file : [ File ] } > , res ) => {
411412 await multipart ( ) ( req , res , ( err ) => err && console . log ( err ) )
@@ -495,8 +496,8 @@ describe('Limits', () => {
495496
496497 const fd = new FormData ( )
497498
498- fd . set ( 'file1' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) )
499- fd . set ( 'file2' , new File ( [ 'bye world' ] , 'bye.txt' , { type : 'text/plain' } ) )
499+ fd . set ( 'file1' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) as Blob )
500+ fd . set ( 'file2' , new File ( [ 'bye world' ] , 'bye.txt' , { type : 'text/plain' } ) as Blob )
500501
501502 await makeFetch ( server ) ( '/' , {
502503 body : fd ,
@@ -514,7 +515,7 @@ describe('Limits', () => {
514515
515516 const fd = new FormData ( )
516517
517- fd . set ( 'file' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) )
518+ fd . set ( 'file' , new File ( [ 'hello world' ] , 'hello.txt' , { type : 'text/plain' } ) as Blob )
518519
519520 await makeFetch ( server ) ( '/' , {
520521 body : fd ,
@@ -534,7 +535,7 @@ describe('Limits', () => {
534535
535536 const fd = new FormData ( )
536537
537- fd . set ( 'file' , new File ( [ 'hello world to everyone' ] , 'hello.txt' , { type : 'text/plain' } ) )
538+ fd . set ( 'file' , new File ( [ 'hello world to everyone' ] , 'hello.txt' , { type : 'text/plain' } ) as Blob )
538539
539540 await makeFetch ( server ) ( '/' , {
540541 body : fd ,
0 commit comments