File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ describe('webRequest module', () => {
22
22
res . setHeader ( 'Location' , 'http://' + req . rawHeaders [ 1 ] ) ;
23
23
res . end ( ) ;
24
24
} else if ( req . url === '/contentDisposition' ) {
25
- res . setHeader ( 'content-disposition' , [ ' attachment; filename=aa%E4%B8%ADaa.txt' ] ) ;
25
+ res . writeHead ( 200 , [
26
+ 'content-disposition' ,
27
+ Buffer . from ( 'attachment; filename=aa中aa.txt' ) . toString ( 'binary' )
28
+ ] ) ;
26
29
const content = req . url ;
27
30
res . end ( content ) ;
28
31
} else {
@@ -478,7 +481,8 @@ describe('webRequest module', () => {
478
481
callback ( { } ) ;
479
482
} ) ;
480
483
const { data, headers } = await ajax ( defaultURL + 'contentDisposition' ) ;
481
- expect ( headers ) . to . to . have . property ( 'content-disposition' , 'attachment; filename=aa%E4%B8%ADaa.txt' ) ;
484
+ const disposition = Buffer . from ( 'attachment; filename=aa中aa.txt' ) . toString ( 'binary' ) ;
485
+ expect ( headers ) . to . to . have . property ( 'content-disposition' , disposition ) ;
482
486
expect ( data ) . to . equal ( '/contentDisposition' ) ;
483
487
} ) ;
484
488
You can’t perform that action at this time.
0 commit comments