[AC-971] tisdk 3.4.0.GA, ios, http post string error
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Resolved |
| Resolution | Invalid |
| Resolution Date | 2015-09-28T15:43:49.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | HTTP, IOS, POST, TCSupportTriage |
| Reporter | 商汝麒 |
| Assignee | Shak Hossain |
| Created | 2014-10-08T07:01:21.000+0000 |
| Updated | 2016-03-08T07:37:17.000+0000 |
Description
when use http post, there's always a ':' appended to data sent if the data is a string
{quote}
h = Ti.Network.createHTTPClient({
cache: false
});
h.open("POST", "http://some_url.com");
h.send( '{"data":[], "data2":{}}' );
{quote}
the request sent is intercepted by http proxy server, to capture the photo attached.
Attachments
| File | Date | Size |
|---|---|---|
| post_bug.tiff | 2014-10-08T07:01:21.000+0000 | 8600 |
Hello, It's not a bug, perhaps related to code formatting. It work's if we set something like this. Check [HTTPClient document](http://docs.appcelerator.com/platform/latest/#!/guide/HTTPClient_and_the_Request_Lifecycle) also. *Testing Environment:* Command-Line Interface, version 4.1.2, Ti SDK: 4.1.0.GA, Platform: Android,iOS Studio Version: 4.1.1 *Test Code*
Initiated ofvar xhr = Ti.Network.createHTTPClient(); xhr.onload = function(e) { //handle response, which at minimum will be an HTTP status code Ti.API.info(this.responseText); }; xhr.open('POST', 'http://some_url.com'); xhr.send({ "data" : "[]", "data2" : "{}" });h.send('{"data":[], "data2":{}}');<?php echo $_POST["data"]; ?> <?php echo $_POST["data2"]; ?>Thanks.[]{}