@@ -638,6 +638,9 @@ private void releaseTaskResource() {
638
638
*/
639
639
private void done (Response resp ) {
640
640
boolean isBlobResp = isBlobResponse (resp );
641
+ WritableMap respmap = getResponseInfo (resp ,isBlobResp );
642
+ emitStateEvent (respmap .copy ());
643
+
641
644
emitStateEvent (getResponseInfo (resp , isBlobResp ));
642
645
switch (responseType ) {
643
646
case KeepInMemory :
@@ -656,7 +659,7 @@ private void done(Response resp) {
656
659
ins .close ();
657
660
os .flush ();
658
661
os .close ();
659
- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , dest );
662
+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , dest , respmap . copy () );
660
663
}
661
664
// response data directly pass to JS context as string.
662
665
else {
@@ -678,11 +681,11 @@ private void done(Response resp) {
678
681
invoke_callback ("Error from file transformer:" + e .getLocalizedMessage (), null );
679
682
return ;
680
683
}
681
- invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , this .destPath );
684
+ invoke_callback (null , ReactNativeBlobUtilConst .RNFB_RESPONSE_PATH , this .destPath , respmap . copy () );
682
685
return ;
683
686
}
684
687
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 () );
686
689
return ;
687
690
}
688
691
try {
@@ -699,9 +702,9 @@ private void done(Response resp) {
699
702
catch (CharacterCodingException ignored ) {
700
703
if (responseFormat == ResponseFormat .UTF8 ) {
701
704
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 () );
703
706
} 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 () );
705
708
}
706
709
}
707
710
}
@@ -746,16 +749,16 @@ private void done(Response resp) {
746
749
}
747
750
748
751
if (ReactNativeBlobUtilFileResp != null && !ReactNativeBlobUtilFileResp .isDownloadComplete ()) {
749
- invoke_callback ("Download interrupted." , null );
752
+ invoke_callback ("Download interrupted." , null , respmap . copy () );
750
753
} else {
751
754
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 () );
753
756
}
754
757
755
758
break ;
756
759
default :
757
760
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 () );
759
762
} catch (IOException e ) {
760
763
invoke_callback ("ReactNativeBlobUtil failed to encode response data to UTF8 string." , null );
761
764
}
0 commit comments