Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit c72e6d7

Browse files
committed
Add Android upload progress support when sending the body As-Is #120
1 parent 02874f0 commit c72e6d7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/android/src/main/java/com/RNFetchBlob/RNFetchBlobBody.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ RNFetchBlobBody setBody(String body) {
7575
break;
7676
case AsIs:
7777
contentLength = this.rawBody.getBytes().length;
78+
requestStream = new ByteArrayInputStream(this.rawBody.getBytes());
7879
break;
7980
case Others:
8081
break;
@@ -117,10 +118,7 @@ public MediaType contentType() {
117118
@Override
118119
public void writeTo(BufferedSink sink) {
119120
try {
120-
if (requestType == RNFetchBlobReq.RequestType.AsIs)
121-
sink.write(rawBody.getBytes());
122-
else
123-
pipeStreamToSink(requestStream, sink);
121+
pipeStreamToSink(requestStream, sink);
124122
} catch(Exception ex) {
125123
RNFetchBlobUtils.emitWarningEvent(ex.getLocalizedMessage());
126124
ex.printStackTrace();

0 commit comments

Comments
 (0)