{ "id": "131806", "key": "AC-1177", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-06-18T07:30:42.000+0000", "created": "2014-06-17T07:37:21.000+0000", "labels": [ "authorization", "header", "httpclient", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "sscott", "key": "sscott", "displayName": "Steven Scott", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:37:33.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "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": "When I run below code on iOS, no Authorization header being passed, but it works well on Android ( Please see response on attachments )\r\n\r\n{code:javascript}\r\n// Simple HTTPClient request with Authorization header\r\nfunction request(data) {\r\n\tvar httpClient = Ti.Network.createHTTPClient({\r\n\t\tonload: function() {\r\n\t\t Ti.API.info( 'SUCCESS --- ' + this.status + '\\n\\t' + this.responseText );\r\n\t },\r\n\t onerror: function() {\t \t\r\n\t \tTi.API.info( 'ERROR --- ' + this.status + '\\n\\t' + this.responseText );\r\n\t\t}\r\n\t});\r\n\t\r\n\thttpClient.open('GET', 'http://api-minh.rhcloud.com/'); // This API simply echo all Headers being passed.\r\n\t\r\n\t// Add Basic Authentication Header\r\n\thttpClient.setRequestHeader('Authorization', 'Basic ' + Titanium.Utils.base64encode(data.email + ':' + data.token));\r\n\thttpClient.setRequestHeader('Content-Type', 'application/json');\r\n\t\r\n\t// Send\r\n\thttpClient.send();\r\n}\r\n\r\nrequest({ email: 'verylonglonglong.name@gmail.com', token: '6557e9dd2d747321ecc65' });\r\n{code}", "attachment": [ { "id": "48998", "filename": "android.png", "author": { "name": "minhnc", "key": "minhnc", "displayName": "Minh Nguyen", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-06-17T07:37:21.000+0000", "size": 79218, "mimeType": "image/png" }, { "id": "48997", "filename": "ios.png", "author": { "name": "minhnc", "key": "minhnc", "displayName": "Minh Nguyen", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-06-17T07:37:21.000+0000", "size": 57277, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: HTTPClient Authorization header NOT being passed", "creator": { "name": "minhnc", "key": "minhnc", "displayName": "Minh Nguyen", "active": true, "timeZone": "Asia/Jakarta" }, "subtasks": [], "reporter": { "name": "minhnc", "key": "minhnc", "displayName": "Minh Nguyen", "active": true, "timeZone": "Asia/Jakarta" }, "environment": "Tested with 3.2.2.GA, 3.2.3.GA", "comment": { "comments": [ { "id": "309289", "author": { "name": "minhnc", "key": "minhnc", "displayName": "Minh Nguyen", "active": true, "timeZone": "Asia/Jakarta" }, "body": "I found exact issue described [here|http://yaymedia.net/?p=1323] and his solution works well.\r\n\r\n{code:javascript}\r\nvar h = Titanium.Utils.base64encode(data.email + ':' + data.token).toString();\r\nh = h.replace(/[\\r\\n]+/, '');\r\nhttpClient.setRequestHeader('Authorization', 'Basic ' + h);\r\n{code}\r\n\r\nThanks to [Steve Carpenter|http://yaymedia.net/?page_id=4]", "updateAuthor": { "name": "minhnc", "key": "minhnc", "displayName": "Minh Nguyen", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-06-17T08:52:06.000+0000", "updated": "2014-06-17T08:52:06.000+0000" }, { "id": "309521", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "Customer found the resolution.", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-06-18T07:30:42.000+0000", "updated": "2014-06-18T07:30:42.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }