Skip to content
This repository was archived by the owner on Mar 21, 2019. It is now read-only.
This repository was archived by the owner on Mar 21, 2019. It is now read-only.

http timeout #101

@chrispoket99

Description

@chrispoket99

Hello. In my project, when I want to do a http request and set the timeout option to 3000 and after that time past the call didn't return a exception, it's like still waiting the response. This is the code:

http.request({
url: global.serverJavaURL+"/j_spring_security_check",
method: "POST",
timeout : 1000,
headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },
content: data
}).then(function (response) {

So I search and found the source of http.request and added a line of code:

connection.setReadTimeout(options.timeout);

I clean and build the project with this modification and trying again my project where I do the http request with the timeout and this time it returns an exception like I expected.

So I think it should be added the change to the class org.nativescript.widgets.Async like this

// apply timeout
if (options.timeout > 0)
{
connection.setConnectTimeout(options.timeout);
connection.setReadTimeout(options.timeout);
}

Like a reference the is a issue that it may be related to this one #2849 https://github.com/NativeScript/NativeScript

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions