From 69a982b40687a0fa3ec593a25278dfc4dcd2764d Mon Sep 17 00:00:00 2001 From: Leonard Krause Date: Wed, 25 May 2022 03:07:17 +0200 Subject: [PATCH] :bug: use correct content-type in uploads when use binaryStreamOnly --- Uploader.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Uploader.m b/Uploader.m index afc0d644..3daf7b91 100644 --- a/Uploader.m +++ b/Uploader.m @@ -26,8 +26,13 @@ - (void)uploadFiles:(RNFSUploadParams*)params // set headers NSString *formBoundaryString = [self generateBoundaryString]; - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", formBoundaryString]; - [req setValue:contentType forHTTPHeaderField:@"Content-Type"]; + if (binaryStreamOnly){ + NSString *contentType = @"application/x-www-form-urlencoded"; + [req setValue:contentType forHTTPHeaderField:@"Content-Type"]; + } else { + NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", formBoundaryString]; + [req setValue:contentType forHTTPHeaderField:@"Content-Type"]; + } for (NSString *key in _params.headers) { id val = [_params.headers objectForKey:key]; if ([val respondsToSelector:@selector(stringValue)]) {