var options = {
:method => Comm.HTTP_REQUEST_METHOD_POST,
:headers => {
"Content-Type" => Comm.REQUEST_CONTENT_TYPE_URL_ENCODED
}
};
var params = {
"param1" => someValue,
"param2" => "otherValue"
};
var url = "an.address.com/path";
Utils.makeJsonRequest(url, params, options, method(:_aCallback));
I've had this behavior on OS X when using SDK versions 1.2.1 - 1.2.5. I have not tried the simulator on windows.
As a workaround I wrote a proxy server which translates the requests into url encoded format. I run it locally and use the following wrapper in the code to use it:
function isSimulated() {
return System.getDeviceSettings().firmwareVersion.toString().equals("[0, 0]");
}
function makeJsonRequest(url, params, options, callback) {
if (isSimulated()) {
System.println("in sim: proxying " + url);
Comm.makeJsonRequest("localhost:8080/proxy + url, params, options, callback);
} else {
System.println("direct request: " + url);
Comm.makeJsonRequest(url, params, options, callback);
}
}
Is my experience consistent with other developers?