Explorar el Código

Fix Android content type checking mechanism

Ben Hsieh hace 8 años
padre
commit
c6752b45c4

+ 2
- 2
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java Ver fichero

207
             }
207
             }
208
 
208
 
209
             if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put")) {
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
                 if(cType == null) {
212
                 if(cType == null) {
213
                     builder.header("Content-Type", "application/octet-stream");
213
                     builder.header("Content-Type", "application/octet-stream");
217
                     if(rawRequestBody.startsWith(RNFetchBlobConst.FILE_PREFIX)) {
217
                     if(rawRequestBody.startsWith(RNFetchBlobConst.FILE_PREFIX)) {
218
                         requestType = RequestType.SingleFile;
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
                         requestType = RequestType.SingleFile;
221
                         requestType = RequestType.SingleFile;
222
                     } else {
222
                     } else {
223
                         requestType = RequestType.AsIs;
223
                         requestType = RequestType.AsIs;