Skip to content

Commit 1cec77e

Browse files
committed
fix(ios): non legacy report format fix
1 parent e67dfa9 commit 1cec77e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/https/request.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export interface HttpsResponse<T = any> {
7272
statusCode?: number;
7373
contentLength: number;
7474
content?: T;
75+
response?: string;
7576
reason?: string;
7677
description?: string;
7778
url?: string;

src/https/request.ios.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ function AFFailure(resolve, reject, task: NSURLSessionDataTask, error: NSError,
275275
sendi.content = new HttpsResponseLegacy(data, sendi.contentLength, url);
276276
resolve(sendi);
277277
} else {
278-
const content: any = {
278+
const response: any = {
279279
body: parsedData,
280280
contentLength: sendi.contentLength,
281281
description: error.description,
@@ -284,9 +284,10 @@ function AFFailure(resolve, reject, task: NSURLSessionDataTask, error: NSError,
284284
};
285285

286286
if (policies.secured === true) {
287-
content.description = '@nativescript-community/https > Invalid SSL certificate! ' + content.description;
287+
response.description = '@nativescript-community/https > Invalid SSL certificate! ' + response.description;
288288
}
289-
sendi.content = content;
289+
sendi.content = parsedData;
290+
sendi.response = response;
290291

291292
resolve(sendi);
292293
}
@@ -369,9 +370,9 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr
369370

370371
let dict = null;
371372
if (opts.body) {
372-
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(JSON.stringify(opts.body)).dataUsingEncoding(NSUTF8StringEncoding), 0);
373+
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(JSON.stringify(opts.body)).dataUsingEncoding(NSUTF8StringEncoding), 0 as any);
373374
} else if (opts.content) {
374-
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(opts.content).dataUsingEncoding(NSUTF8StringEncoding), 0);
375+
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(opts.content).dataUsingEncoding(NSUTF8StringEncoding), 0 as any);
375376
}
376377

377378
manager.requestSerializer.timeoutInterval = opts.timeout ? opts.timeout : 10;

0 commit comments

Comments
 (0)