[TIMOB-3254] Setting data in HTTPClient.send will force a POST connectionType
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Low | 
| Status | Closed | 
| Resolution | Invalid | 
| Resolution Date | 2017-06-08T23:22:04.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | n/a | 
| Components | iOS | 
| Labels | n/a | 
| Reporter | Dhaya Benmessaoud | 
| Assignee | Ingo Muschenetz | 
| Created | 2011-04-15T03:40:35.000+0000 | 
| Updated | 2017-06-08T23:22:04.000+0000 | 
Description
Whenever I try to send data with an HTTPClient it forces the connectionType on POST, even if I set it on GET with HTTPClient.open("GET", url)
I figured out a temporary workaround for this thing, but it would be great if it could be fixed.
if (method == "GET" && data != null ) {
    if ( typeof(data) == 'object' ) {
        var pairs = [];
        for ( var key in data ) {
            if (data.hasOwnProperty(key) ) { pairs.push(key + "=" + data[key]); }
        }
        url += "?" + pairs.join('&');
    } else if ( typeof(data) == 'string' ) {
        url += "?" + data;
    }
    data = null;
}
var loader = Titanium.Network.createHTTPClient();
loader.open(method, url);
/* loader.onload ... */
loader.send(data);
Closing ticket as there has been no input for the last 6 years. Any problems, please file a new ticket.