{ "id": "109314", "key": "AC-2097", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-02-06T18:12:43.000+0000", "created": "2013-02-06T17:15:16.000+0000", "labels": [ "bug", "headers", "http", "ios", "network" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:41:04.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": "I'm working in a application that have this request:\r\n\r\n{code}\r\nvar xhr = Ti.Network.createHTTPClient();\r\n\r\nxhr.setRequestHeader(\"foo\", \"bar\");\r\nxhr.setRequestHeader(\"Content-Type\", \"text/plain\");\r\n\r\nxhr.open(\"POST\", \"http://foo.bar\");\r\n\r\nxhr.send(\"Foobar\");\r\n{code}\r\n\r\nBut I'm having some problems with it (and other people too: http://developer.appcelerator.com/question/147651/setrequestheader-doesnt-work).\r\n\r\nIn *TiNetworkHTTPClientProxy.m* we have this following statement (line 384):\r\n\r\n{code}\r\n-(void)open:(id)args\r\n{\r\n ...\r\n request = [[ASIFormDataRequest requestWithURL:url] retain];\r\n ... \r\n}\r\n{code}\r\n\r\nI think this is cleaning all headers included in request. Am i correctly?\r\n\r\nSo, I changed the code to (because the request already exists):\r\n\r\n{code}\r\n[request requestWithURL:url];\r\n{code}\r\n\r\nAnd it works fine. If I'm correctly, I will make a PR ASAP to titanium_mobile project.", "attachment": [], "flagged": false, "summary": "iOS: Network.HTTPClient is cleaning all request headers", "creator": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "subtasks": [], "reporter": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "environment": "iOS 6.1, SDK 3.0.2.v20130129171611", "comment": { "comments": [ { "id": "237451", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Sorry, apparently I'm wrong. :-(", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-02-06T17:20:38.000+0000", "updated": "2013-02-06T17:20:38.000+0000" }, { "id": "237458", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Could you elaborate?", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-06T17:59:54.000+0000", "updated": "2013-02-06T17:59:54.000+0000" }, { "id": "237459", "author": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "If I put the request headers after the \"open\" statement, it will works fine, because of request instance will exists.", "updateAuthor": { "name": "rafaelks", "key": "rafaelks", "displayName": "Rafael Kellermann Streit", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-02-06T18:01:33.000+0000", "updated": "2013-02-06T18:01:33.000+0000" }, { "id": "237462", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, I'll close it now.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-06T18:12:43.000+0000", "updated": "2013-02-06T18:12:43.000+0000" }, { "id": "280957", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Invalid issue. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2013-11-24T22:18:21.000+0000", "updated": "2013-11-24T22:18:21.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }