Skip to content

Commit e35692b

Browse files
authored
Merge branch 'master' into master
2 parents a28290b + d4f10cf commit e35692b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

demo/app/main-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as Https from "nativescript-https";
22
import {fromObject, Dialogs as dialogs, Page, EventData} from "@nativescript/core";
33
import * as fs from "@nativescript/core/file-system";
4+
45
let page;
56
let viewModel;
67
export function pageLoaded(args: EventData) {

src/https.ios.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ function AFFailure(
392392
let parsedData = getData(data);
393393
const failingURL = error.userInfo.objectForKey("NSErrorFailingURLKey");
394394
if (useLegacy) {
395+
if (!sendi.statusCode) {
396+
return reject(error.localizedDescription);
397+
}
395398
let failure: any = {
396399
description: error.description,
397400
reason: error.localizedDescription,
@@ -404,7 +407,6 @@ function AFFailure(
404407
}
405408
sendi.failure = failure;
406409
sendi.content = new HttpsResponse(data, url);
407-
408410
resolve(sendi);
409411
} else {
410412
let response: any = {
@@ -530,7 +532,7 @@ export function createRequest(
530532
run(resolve, reject) {
531533
const success = function (task: NSURLSessionDataTask, data?: any) {
532534
// TODO: refactor this code with failure one.
533-
let content = useLegacy
535+
let content = useLegacy
534536
? new HttpsResponse(data, opts.url)
535537
: getData(data);
536538
let getHeaders = () => ({});

0 commit comments

Comments
 (0)