{ "id": "138380", "key": "TIMOB-19978", "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": "2014-10-22T15:01:20.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "Community", "engTriage", "headers", "httpclient", "ios" ], "versions": [ { "id": "16904", "description": "Release 5.0.2", "name": "Release 5.0.2", "archived": true, "released": true, "releaseDate": "2015-10-01" } ], "issuelinks": [], "assignee": null, "updated": "2019-11-18T22:58:59.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": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "On iOS, when initiating a call with an empty body on the send object, the content length is being set to 0.\r\n\r\nOn Android this problem does not seem to occur\r\nHowever, as the body is actually empty, it should not set a content length at all. \r\n\r\nTest case:\r\n\r\n{code}\r\n config = {\r\n onload: _.partial(_response, true),\r\n onerror: _.partial(_response, false),\r\n ondatastream: progressHandler,\r\n onsendstream: progressHandler,\r\n onreadystatechange: stateChangeHandler,\r\n timeout: options.timeout || 10000\r\n };\r\n var httpClient = Ti.Network.createHTTPClient(config);\r\n httpClient.open('GET', path);\r\n httpClient.setRequestHeader(\"Content-Type\", \"application/json\");\r\n var body = undefined; //or var body = '';\r\n httpClient.send(body); \r\n{code}\r\n\r\nWhen this is send, the request header is going to be \"content-length: 0\", which should not be the case, the header should be omitted.", "attachment": [], "flagged": false, "summary": "iOS: HTTPClient sets content-length while the body is empty or undefined with GET", "creator": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "environment": "3.4.0 iOS", "comment": { "comments": [ { "id": "329281", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "Hi,\r\n\r\n1. The body you mentioned can be only used in \"POST\" method for passing data. Here is the doc. [http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network.HTTPClient-method-send]\r\n\r\n2. When you use a \"GET\" Method in your request, the body data should be empty, as all the data information contains in url.\r\nSo content-length is necessary for http request header even the body is empty.\r\n\r\nHope this will help you.\r\n\r\nRegards,\r\nShuo", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-10-24T00:44:52.000+0000", "updated": "2014-10-24T00:44:52.000+0000" }, { "id": "329305", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi thanks. Yes I know. But I've already emtied the variable for that reason. I use the same lib for all my calls, and on Android it also works fine. \r\nIt should just not set content length to 0. It should be a missing header. Therefore this is actually a bug. ", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-10-24T07:22:52.000+0000", "updated": "2014-10-24T07:22:52.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }