{ "id": "174733", "key": "AC-6490", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2020-02-14T15:27:35.000+0000", "created": "2020-02-13T13:34:37.000+0000", "labels": [], "versions": [ { "id": "17032", "name": "Appcelerator Studio 4.3.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-02-14T15:27:35.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Hi, \r\nTiimeout property and error event not working for request which is not proper in iOS platform. \r\nExample below:\r\n\r\n{code:js}\r\nvar url = \"https://www.google .com/\";\r\n\r\n// above url have space after keyword google\r\n\r\nTi.Network.createHTTPClient({\r\n\t\t\t\tonload: function(e)\r\n\t\t\t\t{\r\n\t\t\t\t\tTi.API.info(\"Success\");\r\n\t\t\t\t},\r\n\t\t\t\tonerror: function(e)\r\n\t\t\t\t{\r\n\t\t\t\t\tTi.API.info(\"Error: \" + e.error);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 60000\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tclient.open(\"GET\", url);\t\t\t\r\n\t\t\tclient.send(); \r\n{code}\r\n\r\nAbove code, when the request made from iOS platform with incorrect url then, not getting any \r\nsuccess or error callback even and timeout also not working.\r\n\r\nNote: Same code working fine in Android and Windows app\r\n", "attachment": [], "flagged": false, "summary": "Timeout property not working of T.Network.createHttpClient in iOS", "creator": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "454245", "author": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "body": "IOS Version: 13.3\r\nTitanium SDK: 8.2.1.GA", "updateAuthor": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-13T13:37:24.000+0000", "updated": "2020-02-13T13:37:24.000+0000" }, { "id": "454253", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~shishir.roy] I don't think the behaviour you're seeing on Android is a timeout, it's being passed an invalid host so is immediately throwing that as an error {{Error: Invalid host: https://www.google%20.com/}} and not waiting for the timeout.\r\n\r\nUsing an api like httpbins delay shows that the timeout appears to be working as intended on iOS, calling {{https://httpbin.org/delay/10}} will wait 10 seconds before responding, after making the request it will error due to my timeout property only being 1 second\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\nwin.addEventListener('click', () => {\r\n\tvar url = \"https://httpbin.org/delay/10\";\r\n\t// above url have space after keyword google\r\n\tvar client = Ti.Network.createHTTPClient({\r\n\t\tonload: function(e){ \r\n\t\t\tTi.API.info(\"Success\"); \r\n\t\t},\r\n\t\tonerror: function(e) {\r\n\t\t\tTi.API.info(\"Error: \" + e.error);\r\n\t\t},\r\n\t\ttimeout: 1000\r\n\t});\r\n\tclient.open(\"GET\", url);\r\n\tclient.send();\r\n})\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-02-13T15:59:56.000+0000", "updated": "2020-02-13T15:59:56.000+0000" }, { "id": "454262", "author": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yeah, agree with you. But why invalid url is not throwing any error in iOS. \r\n We have scenario if user is entered invalid url while the request to server then it is not throwing any error and also timeout is not happening. \r\n\r\nSo please suggest how it will throw an error if it is invalid url. ", "updateAuthor": { "name": "shishir.roy", "key": "shishir.roy", "displayName": "shishir.roy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-13T16:48:07.000+0000", "updated": "2020-02-13T16:48:07.000+0000" }, { "id": "454285", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~shishir.roy] it looks like from my testing you should be able to check the {{connected}} property whether or not the call has succeeded. \r\n\r\nIn my tests in the simulator, it looks like this boolean is updated immediately, but to be safe you can use a timeout to check this property. \r\n\r\nhttps://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network.HTTPClient-property-connected", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-14T14:07:47.000+0000", "updated": "2020-02-14T14:07:47.000+0000" }, { "id": "454287", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Considering this ticket is about Timeout, I've created a new ticket specifically for improving the error flow with invalid URL: TIMOB-27767\r\n\r\nTherefore I'm closing this ticket, please watch that ticket to be updated on progress.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-14T15:27:35.000+0000", "updated": "2020-02-14T15:27:35.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }