Skip to content

Commit 5aa4115

Browse files
Merge pull request #51 from bobbyngwu/master
Added support for Array object types in iOS
2 parents e89e07e + 2111924 commit 5aa4115

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/https.ios.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,16 @@ export function request(opts: Https.HttpsRequestOptions): Promise<Https.HttpsRes
157157
Object.keys(heads).forEach(key => manager.requestSerializer.setValueForHTTPHeaderField(heads[key] as any, key));
158158
}
159159

160-
let dict: NSMutableDictionary<string, any> = null;
160+
let dict = null;
161161
if (opts.body) {
162162
let cont = opts.body;
163-
if (isObject(cont)) {
163+
if (Array.isArray(cont)) {
164+
dict = NSMutableArray.new();
165+
cont.forEach(function (item, idx) {
166+
dict.addObject(item);
167+
});
168+
}
169+
else if (isObject(cont)) {
164170
dict = NSMutableDictionary.new<string, any>();
165171
Object.keys(cont).forEach(key => dict.setValueForKey(cont[key] as any, key));
166172
}

0 commit comments

Comments
 (0)