Skip to content

Commit

Permalink
fix(ios): non legacy report format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Aug 30, 2023
1 parent e67dfa9 commit 1cec77e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/https/request.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export interface HttpsResponse<T = any> {
statusCode?: number;
contentLength: number;
content?: T;
response?: string;
reason?: string;
description?: string;
url?: string;
Expand Down
11 changes: 6 additions & 5 deletions src/https/request.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function AFFailure(resolve, reject, task: NSURLSessionDataTask, error: NSError,
sendi.content = new HttpsResponseLegacy(data, sendi.contentLength, url);
resolve(sendi);
} else {
const content: any = {
const response: any = {
body: parsedData,
contentLength: sendi.contentLength,
description: error.description,
Expand All @@ -284,9 +284,10 @@ function AFFailure(resolve, reject, task: NSURLSessionDataTask, error: NSError,
};

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

resolve(sendi);
}
Expand Down Expand Up @@ -369,9 +370,9 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr

let dict = null;
if (opts.body) {
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(JSON.stringify(opts.body)).dataUsingEncoding(NSUTF8StringEncoding), 0);
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(JSON.stringify(opts.body)).dataUsingEncoding(NSUTF8StringEncoding), 0 as any);
} else if (opts.content) {
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(opts.content).dataUsingEncoding(NSUTF8StringEncoding), 0);
dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(opts.content).dataUsingEncoding(NSUTF8StringEncoding), 0 as any);
}

manager.requestSerializer.timeoutInterval = opts.timeout ? opts.timeout : 10;
Expand Down

0 comments on commit 1cec77e

Please sign in to comment.