Skip to content

Commit e93162d

Browse files
committed
Allow json body in POST / PUT requests
1 parent ec53484 commit e93162d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ios/OAuthManager/OAuthManager.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,18 @@ - (NSDictionary *) getConfigForProvider:(NSString *)name
443443
URL:apiUrl
444444
items:items];
445445

446+
// Allow json body in POST / PUT requests
447+
446448
NSDictionary *body = [opts objectForKey:@"body"];
447449
if (body != nil) {
448-
for (NSString *key in body) {
449-
NSData *data = [[NSString stringWithFormat:@"%@", [body valueForKey:key]] dataUsingEncoding:NSUTF8StringEncoding];
450-
[request addMultiPartData:data withName:key type:@"application/json"]; // TODO: How should we handle different body types?
451-
}
450+
/*for (NSString *key in body) {
451+
NSString *value = [body valueForKey:key];
452+
453+
if(value != nil) {
454+
[request.content.HTTPBody addObject:];
455+
}
456+
}*/
457+
[request.content setHTTPBody: body];
452458
}
453459

454460
request.account = existingAccount;

0 commit comments

Comments
 (0)