瀏覽代碼

Fix Android content type checking mechanism

Ben Hsieh 9 年之前
父節點
當前提交
c6752b45c4
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+ 2
- 2
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java 查看文件

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;