This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -201,16 +201,18 @@ void __block (^getFieldData)(id field) = ^(id field)
201201 RCTLogWarn (@" RNFetchBlob multipart request builder has found a field without `data` or `name` property, the field will be removed implicitly." );
202202 return ;
203203 }
204- contentType = contentType == nil ? @" application/octet-stream " : contentType;
204+
205205 // field is a text field
206206 if ([field valueForKey: @" filename" ] == nil || content == nil ) {
207+ contentType = contentType == nil ? @" text/plain" : contentType;
207208 [formData appendData: [[NSString stringWithFormat: @" --%@ \r\n " , boundary] dataUsingEncoding: NSUTF8StringEncoding]];
208209 [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]];
210211 [formData appendData: [[NSString stringWithFormat: @" %@ \r\n " , content] dataUsingEncoding: NSUTF8StringEncoding]];
211212 }
212213 // field contains a file
213214 else {
215+ contentType = contentType == nil ? @" application/octet-stream" : contentType;
214216 NSMutableData * blobData;
215217 if (content != nil )
216218 {
You can’t perform that action at this time.
0 commit comments