mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
http timeout fixes + test
This commit is contained in:
@@ -32,13 +32,13 @@ export function request(options: http.HttpRequestOptions): Promise<http.HttpResp
|
||||
}
|
||||
}
|
||||
|
||||
if (types.isNumber(options.timeout)) {
|
||||
urlRequest.timeoutInterval = options.timeout * 1000;
|
||||
}
|
||||
|
||||
if (types.isString(options.content)) {
|
||||
urlRequest.HTTPBody = NSString.alloc().initWithString(options.content).dataUsingEncoding(4);
|
||||
}
|
||||
|
||||
if (types.isNumber(options.timeout)) {
|
||||
urlRequest.timeoutInterval = options.timeout / 1000;
|
||||
}
|
||||
|
||||
var dataTask = session.dataTaskWithRequestCompletionHandler(urlRequest,
|
||||
function (data: NSData, response: NSHTTPURLResponse, error: NSError) {
|
||||
|
||||
2
http/http.d.ts
vendored
2
http/http.d.ts
vendored
@@ -72,7 +72,7 @@ declare module "http" {
|
||||
content?: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the request timeout.
|
||||
* Gets or sets the request timeout in milliseconds.
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user