Browse Source

Fix Android content type checking mechanism

Ben Hsieh 7 years ago
parent
commit
c6752b45c4
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+ 2
- 2
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java View File

@@ -207,7 +207,7 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
207 207
             }
208 208
 
209 209
             if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put")) {
210
-                String cType = getHeaderIgnoreCases(mheaders, "content-type").toLowerCase();
210
+                String cType = getHeaderIgnoreCases(mheaders, "Content-Type").toLowerCase();
211 211
 
212 212
                 if(cType == null) {
213 213
                     builder.header("Content-Type", "application/octet-stream");
@@ -217,7 +217,7 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
217 217
                     if(rawRequestBody.startsWith(RNFetchBlobConst.FILE_PREFIX)) {
218 218
                         requestType = RequestType.SingleFile;
219 219
                     }
220
-                    else if (cType.contains(";base64") || cType.startsWith("application/octet")) {
220
+                    else if (cType.toLowerCase().contains(";base64") || cType.toLowerCase().startsWith("application/octet")) {
221 221
                         requestType = RequestType.SingleFile;
222 222
                     } else {
223 223
                         requestType = RequestType.AsIs;