diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java index 8a81a832e..990134bc1 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java @@ -239,7 +239,7 @@ else if (value.equalsIgnoreCase("utf8")) } } - if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch")) { + if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch") || method.equalsIgnoreCase("delete")) { String cType = getHeaderIgnoreCases(mheaders, "Content-Type").toLowerCase(); if(rawRequestBodyArray != null) { @@ -300,7 +300,7 @@ else if(cType.isEmpty()) { break; case WithoutBody: - if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch")) + if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch") || method.equalsIgnoreCase("delete")) { builder.method(method, RequestBody.create(null, new byte[0])); } diff --git a/ios/RNFetchBlobReqBuilder.m b/ios/RNFetchBlobReqBuilder.m index 15465a1ae..878b19e01 100644 --- a/ios/RNFetchBlobReqBuilder.m +++ b/ios/RNFetchBlobReqBuilder.m @@ -99,8 +99,8 @@ +(void) buildOctetRequest:(NSDictionary *)options dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSMutableData * blobData; long size = -1; - // if method is POST, PUT or PATCH, convert data string format - if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"] || [[method lowercaseString] isEqualToString:@"patch"]) { + // if method is POST, PUT, PATCH or DELETE, convert data string format + if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"] || [[method lowercaseString] isEqualToString:@"patch"] || [[method lowercaseString] isEqualToString:@"delete"]) { // generate octet-stream body if(body != nil) { __block NSString * cType = [[self class] getHeaderIgnoreCases:@"content-type" fromHeaders:mheaders]; @@ -117,7 +117,7 @@ +(void) buildOctetRequest:(NSDictionary *)options orgPath = [RNFetchBlobFS getPathOfAsset:orgPath]; if([orgPath hasPrefix:AL_PREFIX]) { - + [RNFetchBlobFS readFile:orgPath encoding:nil onComplete:^(NSData *content, NSString * err) { if(err != nil) { @@ -131,7 +131,7 @@ +(void) buildOctetRequest:(NSDictionary *)options onComplete(request, [content length]); } }]; - + return; } size = [[[NSFileManager defaultManager] attributesOfItemAtPath:orgPath error:nil] fileSize];