File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed
packages/auth/src/platform_node
scripts/emulator-testing/emulators Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,7 @@ import { FetchProvider } from '../core/util/fetch_provider';
30
30
import { getDefaultEmulatorHost } from '@firebase/util' ;
31
31
32
32
// Initialize the fetch polyfill, the types are slightly off so just cast and hope for the best
33
- FetchProvider . initialize (
34
- fetch ,
35
- Headers ,
36
- Response
37
- ) ;
33
+ FetchProvider . initialize ( fetch , Headers , Response ) ;
38
34
39
35
// First, we set up the various platform-specific features for Node (register
40
36
// the version and declare the Node getAuth function)
Original file line number Diff line number Diff line change @@ -62,19 +62,20 @@ export abstract class Emulator {
62
62
( downloadComplete , downloadFailed ) => {
63
63
fetch ( this . binaryUrl )
64
64
. then ( resp => {
65
- if ( resp . status !== 200 ) {
65
+ if ( resp . status !== 200 || resp . body === null ) {
66
66
console . log ( 'Download of emulator failed: ' , resp . statusText ) ;
67
67
downloadFailed ( ) ;
68
+ } else {
69
+ const reader = resp . body . getReader ( ) ;
70
+ reader . read ( ) . then ( function readChunk ( { done, value } ) : any {
71
+ if ( done ) {
72
+ downloadComplete ( ) ;
73
+ } else {
74
+ writer . write ( value ) ;
75
+ return reader . read ( ) . then ( readChunk ) ;
76
+ }
77
+ } ) ;
68
78
}
69
- const reader = resp . body ?. getReader ( ) ;
70
- reader ?. read ( ) . then ( function readChunk ( { done, value } ) : any {
71
- if ( done ) {
72
- downloadComplete ( ) ;
73
- } else {
74
- writer . write ( value ) ;
75
- return reader . read ( ) . then ( readChunk ) ;
76
- }
77
- } ) ;
78
79
} )
79
80
. catch ( e => {
80
81
console . log ( `Download of emulator failed: ${ e } ` ) ;
You can’t perform that action at this time.
0 commit comments