[TIMOB-13275] Android: HTTPClient not sending POST vars
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-03-29T21:07:59.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 07 API, 2013 Sprint 07 |
Components | Android |
Labels | HttpClient, android, ipass1, sdk2.1.4, triage |
Reporter | Patrick Jongmans |
Assignee | Joshua Quick |
Created | 2012-11-15T15:47:11.000+0000 |
Updated | 2018-08-06T17:37:06.000+0000 |
Description
When using the current SDK 2.1.4 the POST DATA is not sending on Android.
A normal json format post is being send:
//THIS IS NOT RECEIVED ON THE SERVER (ONLY ANDROID) ---
var orderOptions = {};
orderOptions.username = 'USERNAME';
orderOptions.password = 'PASSWORD';
orderOptions.somevar = 'Some data';
var client = Ti.Network.createHTTPClient({
onload : function(e) {
}
},
onerror : function(e) {
if(errorCallback != null) {
errorCallback(false);
}
},
timeout : 5000
});
client.open("POST", 'http://www.somedomain.com/afile.php');
client.setRequestHeader('Content-Type', 'text/html; charset=utf-8;');
client.send(orderOptions);
Is this issue being escalated? Reference: http://developer.appcelerator.com/question/146006/google-app-engine-seems-to-confuse-android-post-with-get-over-httpclient#answer-253222
Tested this and confirming bug. (works as expected on android)
Code on my server:
Titanium code:
Expected response from server:
Real response from server on Android
Same happens on 3.0.2.GA
[~penrique] Shouldn't the content type signify form encoded data (eg:application/x-www-form-urlencoded). Can you retry with the new content type.
Resolving this as invalid since I suspect this is due to the wrong content type. If it is not so, please reopen ticket.
It would be great if this was re-opened. There seems to be some intermittent issues with the POST method being confused with GET and that is why the POST parameters aren't being received properly. I am able to duplicate this with applications running with the latest Android ICS OS. Something this simple: xhr.open('POST', 'http://www.some-web-site.com/mobileupdate/masterstack'); xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8'); xhr.send(); Although no data is being sent in this example, it should still be read as a POST. It is not: [22/Apr/2013:16:58:06 -0700] "GET /mobileupdate/masterstack/ HTTP/1.1" 200 146036 - - "www.my_website.com" ms=58 cpu_ms=21 cpm_usd=0.016321 app_engine_release=1.7.7 However, the POST works fine on devices running Gingerbread. See reference: http://developer.appcelerator.com/question/146006/google-app-engine-seems-to-confuse-android-post-with-get-over-httpclient Titanium 3.1; SDK 3.0.2.GA
[~jquick] Could you see if the POST is working as expected for you.
Closing as invalid. If incorrect, please reopen.