Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

HttpClient Post request not sending JSON since latest update

$
0
0

I have an app built on Android and IOS and the HTTP requests have been working fine. Today i installed the latest node.js updates and suddenly this code is sending null in the POST request on iOS but still works perfectly fine on Android? The code is the same on both platforms.

I don't get an error as the API returns that the post is sending null.

var reg1Post = JSON.stringify({
    'ApplicationKey': appKey,
    'Username':$.regEmail.value,
    'languageCode':Ti.App.Properties.getString("locale"),
    'languageID':Ti.App.Properties.getString("localeID")}); 
 
    var webapi_reg1 = Ti.Network.createHTTPClient({
    onload: function() {
        // handle the response
        var obj = JSON.parse(this.responseText);
        Ti.API.info(this.responseText);
 
    },
    onerror: function(e) {
        Ti.API.info("REG1 ERROR >> " + e.error);
        Ti.API.info(this.responseText);
    }
});
 
webapi_reg1.setRequestHeader("Content-Type", "application/json; charset=utf8-8");
webapi_reg1.open("POST", webURL + "/API/RegisterAccount");
webapi_reg1.send(reg1Post);
Ti.API.info(webURL + "/API/RegisterAccount");

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>