@@ -206,7 +206,7 @@ function requestAsEventEmitter(opts) {
206206 }
207207 } ) ;
208208
209- cacheReq . on ( 'request' , req => {
209+ cacheReq . once ( 'request' , req => {
210210 req . once ( 'error' , err => {
211211 clearInterval ( progressInterval ) ;
212212
@@ -220,7 +220,7 @@ function requestAsEventEmitter(opts) {
220220 ee . emit ( 'error' , new got . RequestError ( err , opts ) ) ;
221221 } ) ;
222222
223- ee . on ( 'request' , req => {
223+ ee . once ( 'request' , req => {
224224 ee . emit ( 'uploadProgress' , {
225225 percent : 0 ,
226226 transferred : 0 ,
@@ -347,10 +347,10 @@ function asPromise(opts) {
347347 } ) ;
348348 } ) ;
349349
350- ee . on ( 'error' , reject ) ;
350+ ee . once ( 'error' , reject ) ;
351+ ee . on ( 'redirect' , proxy . emit . bind ( proxy , 'redirect' ) ) ;
351352 ee . on ( 'uploadProgress' , proxy . emit . bind ( proxy , 'uploadProgress' ) ) ;
352353 ee . on ( 'downloadProgress' , proxy . emit . bind ( proxy , 'downloadProgress' ) ) ;
353- ee . on ( 'redirect' , proxy . emit . bind ( proxy , 'redirect' ) ) ;
354354 } ) ;
355355
356356 const promise = timeoutFn ( cancelable ) ;
@@ -427,8 +427,8 @@ function asStream(opts) {
427427 proxy . emit ( 'response' , res ) ;
428428 } ) ;
429429
430- ee . on ( 'redirect' , proxy . emit . bind ( proxy , 'redirect' ) ) ;
431430 ee . on ( 'error' , proxy . emit . bind ( proxy , 'error' ) ) ;
431+ ee . on ( 'redirect' , proxy . emit . bind ( proxy , 'redirect' ) ) ;
432432 ee . on ( 'uploadProgress' , proxy . emit . bind ( proxy , 'uploadProgress' ) ) ;
433433 ee . on ( 'downloadProgress' , proxy . emit . bind ( proxy , 'downloadProgress' ) ) ;
434434
0 commit comments