|
@@ -201,16 +201,18 @@
|
201
|
201
|
RCTLogWarn(@"RNFetchBlob multipart request builder has found a field without `data` or `name` property, the field will be removed implicitly.");
|
202
|
202
|
return;
|
203
|
203
|
}
|
204
|
|
- contentType = contentType == nil ? @"application/octet-stream" : contentType;
|
|
204
|
+
|
205
|
205
|
// field is a text field
|
206
|
206
|
if([field valueForKey:@"filename"] == nil || content == nil) {
|
|
207
|
+ contentType = contentType == nil ? @"text/plain" : contentType;
|
207
|
208
|
[formData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
|
208
|
209
|
[formData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n", name] dataUsingEncoding:NSUTF8StringEncoding]];
|
209
|
|
- [formData appendData:[[NSString stringWithFormat:@"Content-Type: text/plain\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
|
210
|
+ [formData appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n\r\n", contentType] dataUsingEncoding:NSUTF8StringEncoding]];
|
210
|
211
|
[formData appendData:[[NSString stringWithFormat:@"%@\r\n", content] dataUsingEncoding:NSUTF8StringEncoding]];
|
211
|
212
|
}
|
212
|
213
|
// field contains a file
|
213
|
214
|
else {
|
|
215
|
+ contentType = contentType == nil ? @"application/octet-stream" : contentType;
|
214
|
216
|
NSMutableData * blobData;
|
215
|
217
|
if(content != nil)
|
216
|
218
|
{
|