Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14613] Android: HTTP Client onsendstream does not fire when sending a POST request

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNeeds more info
Resolution Date2013-08-26T22:34:36.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 18, 2013 Sprint 18 API
ComponentsAndroid
Labelsn/a
ReporterDavide Cassenti
AssigneeIngo Muschenetz
Created2013-07-22T08:54:14.000+0000
Updated2017-03-22T22:29:18.000+0000

Description

Problem description

When sending a POST request, under some circumstances the event 'onsendstream' does not fire properly.

Test code

The following code is working fine for me, but fails for the customer - using different servers. It might be related to the information sent from the different servers; when the code fails, the event is only fired once with a negative progress value.
var request = Ti.Network.createHTTPClient({
    onload: function() {
        Ti.API.info(this.responseText);
    },

    onerror: function(e) {        
        Ti.API.info(JSON.stringify(e));
    },

    onsendstream: function(e) {
        Ti.API.info('progress_onsendstream: ' + e.progress)
    },

    ondatastream: function(e) {
        Ti.API.info('progress_ondatastream: ' + e.progress)
    },

    timeout: 60000
});

var f = Ti.Filesystem.getFile("somefile");
var cnt = f.read();

request.open("POST", serverurl);
request.setRequestHeader("Content-type", "application/json");
request.send({
    "name": f.name,
    "data": cnt,
});

Comments

  1. Lee Morris 2017-03-22

    Closing ticket due to the information that was requested was not provided.

JSON Source