{ "id": "170913", "key": "TIMOB-25698", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2018-01-23T06:15:50.000+0000", "priority": null, "labels": [], "versions": [ { "id": "17532", "name": "Release 5.1.1", "archived": false, "released": true, "releaseDate": "2015-11-24" }, { "id": "19988", "description": "", "name": "Release 7.0.1", "archived": false, "released": true, "releaseDate": "2017-12-21" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:37.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "It's a simple http Get API query, it failed on android but iOS works fine. The http POST however works on both android and iOS.\r\n\r\nThis has been tested on SDK 7.0.1 and 5.1.1\r\n\r\nSample Code:\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white',\r\n});\r\n\r\nwin.addEventListener(\"click\", function(){\r\n\tvar url = \"https://files.staging-trimbledata.com/api/directories\";\r\n\tvar oHead = {\r\n\t\t\"Authorization\":\"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiZmlsZXMiXSwiaXNzIjoiY2VjX2N3IiwiZXhwIjoxNTQ4MjIxODAzLCJzdWIiOiJ0cm1iLnNlcnZpY2VzLmF1dGgudjEifQ.fkAtBw2s0e3ub_4H_EJYZOGgLb1wl5XgJK3yvtl9wu26UcayV_pn5BytB-BI9cV5bE2O35Hl3ssC2tSPmLgQ56eQkBL4b6CpsJfKhtJR783dqkHMfWKbTjNvJGmWYH9DXRg8TKn5glR-Dqueg-7H5YQBfZin6bJOl4svf2Eu9gvQ9WAjKp6uYip0Mj_M-WtBfgXy_zmb2QFgOga4HyTxNaltf6GxrzgxtQfOBdkaX8V5wrfzKmKUYdj4rxLCi_--Fb2BQApM5fv2hdh4WppJ0Y0GCVmuBrMacIk4KooU7TMisC_no_xyT36bpHCz6t2DObY2TYZ1aKJD71nIT9_Vpg\",\r\n\t\t\"Content-Type\":\"application/json\"\r\n\t};\r\n\r\n\tvar client = Ti.Network.createHTTPClient({\r\n\t // function called when the response data is available\r\n\t onload : function(e) {\r\n\t Ti.API.info(\"Received text: \" + this.responseText);\r\n\t alert('success');\r\n\t },\r\n\t // function called when an error occurs, including a timeout\r\n\t onerror : function(e) {\r\n\t Ti.API.info(e.error);\r\n\t alert('error');\r\n\t },\r\n\t timeout : 50000 // in milliseconds\r\n\t });\r\n\t // Prepare the connection.\r\n\t client.open(\"GET\", url);\r\n\t for(var key in oHead){\r\n\t \tTi.API.debug(\"set header: \"+key);\r\n\t \tclient.setRequestHeader(key, oHead[key]);\r\n\t }\r\n\t // Send the request.\r\n\t client.send();\r\n});\r\n\r\nwin.open();", "attachment": [], "flagged": false, "summary": "Android: HTTP GET returns 500 internal server error while it's working fine on the iOS", "creator": { "name": "kenjorai", "key": "kenjorai", "displayName": "Kai Lu", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kenjorai", "key": "kenjorai", "displayName": "Kai Lu", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "433505", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~kenjorai],\r\nThanks for sharing with us. When we hit the [link|https://files.staging-trimbledata.com/api/directories] through browser it provides a HTTP [ERROR|https://s17.postimg.org/59f8nw5q7/Screen_Shot_2018-01-23_at_4.30.39_PM.png] .Can you please try using a valid url, test again and let us know.\r\n\r\n\r\nBest", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-01-23T10:33:10.000+0000", "updated": "2018-01-23T10:33:10.000+0000" }, { "id": "433508", "author": { "name": "kenjorai", "key": "kenjorai", "displayName": "Kai Lu", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Mostafizur,\r\n\r\nThis is a valid link, if you put it in a browser, it will give you a 401 error which means unauthorised access.\r\n\r\nYou will need to put the Authorization header in the http GET request.\r\n\r\nTo test it properly without Titanium, you will need to install POSTMAN or you can simply create a project and copy & paste my sample code.\r\n\r\nRegards", "updateAuthor": { "name": "kenjorai", "key": "kenjorai", "displayName": "Kai Lu", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-23T11:16:16.000+0000", "updated": "2018-01-23T11:17:31.000+0000" }, { "id": "433510", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "It works on Postman as well (even without the {{Content-Type}}). Looks valid to me, moving to TIMOB.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-23T12:30:09.000+0000", "updated": "2018-01-23T12:30:09.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }