File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -417,15 +417,11 @@ async function handleMessage(message, sender) {
417
417
const user = details . user || null ;
418
418
const password = details . password || null ;
419
419
let body = details . data || null ;
420
+ // deprecate once body supports more data types
421
+ // the `binary` key will no longer needed
420
422
if ( typeof body === "string" && details . binary ) {
421
- const len = body . length ;
422
- const arr = new Uint8Array ( len ) ;
423
- for ( let i = 0 ; i < len ; i ++ ) {
424
- arr [ i ] = body . charCodeAt ( i ) ;
425
- }
426
- body = new Blob ( [ arr ] , { type : "text/plain" } ) ;
423
+ body = new TextEncoder ( ) . encode ( body ) ;
427
424
}
428
-
429
425
// xhr instances automatically filter out unexpected user values
430
426
xhr . timeout = details . timeout ;
431
427
xhr . responseType = details . responseType ;
You can’t perform that action at this time.
0 commit comments