fix(ios): headers are not being sent (#284)

This commit is contained in:
Christiaan Baartse 2020-10-27 13:56:35 +01:00 committed by GitHub
parent 24b15c5f5a
commit dcae9269b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,8 +103,6 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
- (void)applyRequestHeaders:(NSDictionary*)headers toRequest:(NSMutableURLRequest*)req - (void)applyRequestHeaders:(NSDictionary*)headers toRequest:(NSMutableURLRequest*)req
{ {
[req setValue:@"XMLHttpRequest" forHTTPHeaderField:@"X-Requested-With"]; [req setValue:@"XMLHttpRequest" forHTTPHeaderField:@"X-Requested-With"];
[self.webViewEngine evaluateJavaScript:@"navigator.userAgent" completionHandler:^(NSString* userAgent, NSError* error) {
[req setValue:userAgent forHTTPHeaderField:@"User-Agent"];
for (NSString* headerName in headers) { for (NSString* headerName in headers) {
id value = [headers objectForKey:headerName]; id value = [headers objectForKey:headerName];
@ -130,7 +128,6 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
} }
} }
} }
}];
} }
- (NSURLRequest*)requestForUploadCommand:(CDVInvokedUrlCommand*)command fileData:(NSData*)fileData - (NSURLRequest*)requestForUploadCommand:(CDVInvokedUrlCommand*)command fileData:(NSData*)fileData