Registry Mirror
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

Open
Open

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

Activity

  1. sant123 commented on Jun 1, 2017

    @sant123

    This is the related issue NativeScript/NativeScript#2849
    Thank you @chrispoket99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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