mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
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
This commit is contained in:
@ -534,7 +534,8 @@ export var test_getString_FromVariousUrls_ShouldWorkProperly = function (done) {
|
|||||||
var urls = [
|
var urls = [
|
||||||
"https://it-ebooks-api.info/v1/book/1615005640",
|
"https://it-ebooks-api.info/v1/book/1615005640",
|
||||||
"https://www.telerik.com",
|
"https://www.telerik.com",
|
||||||
"https://spreadsheets.google.com/tq?key=1tJ64Y8hje0ui4ap9U33h3KWwpxT_-JuVMSZzxD2Er8k"
|
"https://spreadsheets.google.com/tq?key=1tJ64Y8hje0ui4ap9U33h3KWwpxT_-JuVMSZzxD2Er8k",
|
||||||
|
"https://chase.arborgoldcloud.net/mobilehandler/mobiledatahandler.ashx?ProcedureName=MEstimGetJobListSpeed&@prmSalesRep=%&@prmStartDate=11/1/2015&@prmEndDate=12/8/2015&@prmStatusFilter=2"
|
||||||
];
|
];
|
||||||
|
|
||||||
var i: number;
|
var i: number;
|
||||||
|
@ -75,7 +75,8 @@ function buildJavaOptions(options: http.HttpRequestOptions) {
|
|||||||
|
|
||||||
var javaOptions = new com.tns.Async.Http.RequestOptions();
|
var javaOptions = new com.tns.Async.Http.RequestOptions();
|
||||||
|
|
||||||
javaOptions.url = options.url;
|
javaOptions.url = options.url.replace("%", "%25");
|
||||||
|
|
||||||
if (types.isString(options.method)) {
|
if (types.isString(options.method)) {
|
||||||
javaOptions.method = options.method;
|
javaOptions.method = options.method;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ export function request(options: http.HttpRequestOptions): Promise<http.HttpResp
|
|||||||
sessionConfig, null, queue);
|
sessionConfig, null, queue);
|
||||||
|
|
||||||
var urlRequest = NSMutableURLRequest.requestWithURL(
|
var urlRequest = NSMutableURLRequest.requestWithURL(
|
||||||
NSURL.URLWithString(options.url));
|
NSURL.URLWithString(options.url.replace("%", "%25")));
|
||||||
|
|
||||||
urlRequest.HTTPMethod = types.isDefined(options.method) ? options.method : GET;
|
urlRequest.HTTPMethod = types.isDefined(options.method) ? options.method : GET;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user