@@ -638,6 +638,9 @@ private void releaseTaskResource() {
638638 */
639639 private void done (Response resp ) {
640640 boolean isBlobResp = isBlobResponse (resp );
641+ WritableMap respmap = getResponseInfo (resp ,isBlobResp );
642+ emitStateEvent (respmap .copy ());
643+
641644 emitStateEvent (getResponseInfo (resp , isBlobResp ));
642645 switch (responseType ) {
643646 case KeepInMemory :
@@ -656,7 +659,7 @@ private void done(Response resp) {
656659 ins .close ();
657660 os .flush ();
658661 os .close ();
659- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , dest );
662+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , dest , respmap . copy () );
660663 }
661664 // response data directly pass to JS context as string.
662665 else {
@@ -678,11 +681,11 @@ private void done(Response resp) {
678681 invoke_callback ("Error from file transformer:" + e .getLocalizedMessage (), null );
679682 return ;
680683 }
681- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , this .destPath );
684+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , this .destPath , respmap . copy () );
682685 return ;
683686 }
684687 if (responseFormat == ResponseFormat .BASE64 ) {
685- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_BASE64 , android .util .Base64 .encodeToString (b , Base64 .NO_WRAP ));
688+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_BASE64 , android .util .Base64 .encodeToString (b , Base64 .NO_WRAP ), respmap . copy () );
686689 return ;
687690 }
688691 try {
@@ -699,9 +702,9 @@ private void done(Response resp) {
699702 catch (CharacterCodingException ignored ) {
700703 if (responseFormat == ResponseFormat .UTF8 ) {
701704 String utf8 = new String (b );
702- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_UTF8 , utf8 );
705+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_UTF8 , utf8 , respmap . copy () );
703706 } else {
704- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_BASE64 , android .util .Base64 .encodeToString (b , Base64 .NO_WRAP ));
707+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_BASE64 , android .util .Base64 .encodeToString (b , Base64 .NO_WRAP ), respmap . copy () );
705708 }
706709 }
707710 }
@@ -746,16 +749,16 @@ private void done(Response resp) {
746749 }
747750
748751 if (ReactNativeBlobUtilFileResp != null && !ReactNativeBlobUtilFileResp .isDownloadComplete ()) {
749- invoke_callback ("Download interrupted." , null );
752+ invoke_callback ("Download interrupted." , null , respmap . copy () );
750753 } else {
751754 this .destPath = this .destPath .replace ("?append=true" , "" );
752- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , this .destPath );
755+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , this .destPath , respmap . copy () );
753756 }
754757
755758 break ;
756759 default :
757760 try {
758- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_UTF8 , new String (resp .body ().bytes (), "UTF-8" ));
761+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_UTF8 , new String (resp .body ().bytes (), "UTF-8" ), respmap . copy () );
759762 } catch (IOException e ) {
760763 invoke_callback ("ReactNativeBlobUtil failed to encode response data to UTF8 string." , null );
761764 }
0 commit comments