tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

docs: add responseDictionary to HTTPClient documentation #14101

Closed m1ga closed 2 months ago

m1ga commented 2 months ago

fixes https://github.com/tidev/titanium-sdk/issues/14096

Test

var client = Ti.Network.createHTTPClient({
    onload : function(e) {
        console.log(this.responseDictionary);
    },
    onerror : function(e) {},
    timeout : 5000  // in milliseconds
});
client.open("GET", "https://httpbin.org/json");
client.send();

tested on Android and iOS

cb1kenobi commented 2 months ago

Wait a sec, I'm confused... is it responseDictionary or responseDict?

I'm also confused as to why the property isn't just called json.

m1ga commented 2 months ago

oh, sorry. It is responseDictionary https://github.com/tidev/titanium-sdk/blob/266b6d5ed1d2b9ac77d5de999d5ab2a352f2fa1f/android/modules/network/src/java/ti/modules/titanium/network/HTTPClientProxy.java#L125 it was added 6 years ago https://github.com/tidev/titanium-sdk/pull/9893 :) [TIMOB-25533] Implement responseDictionary but as it isn't documented I guess no one is using it and just uses JSON.parse()