HTTPClient (XHR) GET request received by server as POST
I have a very simple createHTTPClient request as follows:
var xhrTagPhoto = Ti.Network.createHTTPClient();
xhrTagPhoto.open( 'GET', 'http://server/working-server-script.php' );
xhrTagPhoto.send({
t : 'test tag',
i : 1
});
On the server, however, the two sent parameters are showing up in the $_POST array while the $_GET array is empty.
How can I get these parameters to actually come across GET params?
Thanks in advance for any pointers.
2 Answers
-
Accepted Answer
I looked at the code in git hub and it appears to me that all data passed in is being set as post data when using send.
either here…
//body of request [request appendPostData:[arg dataUsingEncoding:NSUTF8StringEncoding]];
or here…
value = [TiUtils stringValue:value]; [request setPostValue:(NSString*)value forKey:(NSString*)key];
so I think without a bug fix you are going to have to append the values directly on the URL
-
This should support POST, GET, PUT, DELETE. Basic stuff…