Skip to content

Commit 91dffc1

Browse files
author
Vladimir Enchev
committed
url with % fixed
It seems that this url is a special case since url encoding techniques failed for both ios and android. For ios: stringByAddingPercentEscapesUsingEncoding stringByAddingPercentEncodingWithAllowedCharacters For android: java.net.URLEncoder
1 parent 30e51ac commit 91dffc1

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

apps/tests/http-tests.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ export var test_getString_FromVariousUrls_ShouldWorkProperly = function (done) {
534534
var urls = [
535535
"https://it-ebooks-api.info/v1/book/1615005640",
536536
"https://www.telerik.com",
537-
"https://spreadsheets.google.com/tq?key=1tJ64Y8hje0ui4ap9U33h3KWwpxT_-JuVMSZzxD2Er8k"
537+
"https://spreadsheets.google.com/tq?key=1tJ64Y8hje0ui4ap9U33h3KWwpxT_-JuVMSZzxD2Er8k",
538+
"https://chase.arborgoldcloud.net/mobilehandler/mobiledatahandler.ashx?ProcedureName=MEstimGetJobListSpeed&@prmSalesRep=%&@prmStartDate=11/1/2015&@prmEndDate=12/8/2015&@prmStatusFilter=2"
538539
];
539540

540541
var i: number;

http/http-request.android.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ function buildJavaOptions(options: http.HttpRequestOptions) {
7575

7676
var javaOptions = new com.tns.Async.Http.RequestOptions();
7777

78-
javaOptions.url = options.url;
78+
javaOptions.url = options.url.replace("%", "%25");
79+
7980
if (types.isString(options.method)) {
8081
javaOptions.method = options.method;
8182
}

http/http-request.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function request(options: http.HttpRequestOptions): Promise<http.HttpResp
2020
sessionConfig, null, queue);
2121

2222
var urlRequest = NSMutableURLRequest.requestWithURL(
23-
NSURL.URLWithString(options.url));
23+
NSURL.URLWithString(options.url.replace("%", "%25")));
2424

2525
urlRequest.HTTPMethod = types.isDefined(options.method) ? options.method : GET;
2626

0 commit comments

Comments
 (0)