node-rest-client icon indicating copy to clipboard operation
node-rest-client copied to clipboard

Client is submitting the request again by itself after timeout time

Open ranupoju0126 opened this issue 7 years ago • 0 comments

HI,

below is my code **var options = {user: config.jobMonitor.user, password: config.jobMonitor.password} var client = new Client(options);

    var args = {
        data: postData,
        headers: {
            "test-header": "client-api",
            "Content-Type": "application/json"
        },
        requestConfig: {
            timeout: 120000, //request timeout in milliseconds
        },
        responseConfig: {
            timeout: 1000 //response timeout
        }

    }

var req = client.post(config.jobMonitor.uri, args, function (data, response) { pageResult.currentPage = parseInt(data.currentPageIndex); pageResult.count = parseInt(data.resultsCount); pageResult.jobs = data.jobDetails; pageResult.pages = parseInt(data.numberOfPages);

        if(response.statusCode == 200){
            pageResult.statusCode = response.statusCode;
            self.emit('send-data', pageResult);
        }

    });

    req.on('requestTimeout', function (req) {
        console.log('request has expired');
        self.emit('send-error','timeout')
        req.abort();
    });

    req.on('responseTimeout', function (res) {
        console.log('response has expired');

    });
    req.on('error', function (err) {
        console.log('request error');
    });
}**

after 120 seconds, its not timing out and the client is submitting the request again by itself image

Please see the above image.... after every 2 mins(120 seconds) there is a log for post data to client.

ranupoju0126 avatar Nov 17 '17 17:11 ranupoju0126