{ "id": "118021", "key": "TIMOB-15093", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "2013-08-06T14:16:02.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "15479", "description": "Release 3.1.2", "name": "Release 3.1.2", "archived": true, "released": true, "releaseDate": "2013-07-31" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:04:27.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": "Hello,\r\n\r\nAt this time, it's possible to pass a data argument to httpClient.send method for POST request. (an object will be serialized)\r\n\r\nI don't know if people would need the following but I found it useful.\r\nI didn't want to concatenate params to url by hand anymore, for GET requests.\r\n\r\nA more elegant solution was to create a simple function that would do the same for GET request as you do for POSTs.\r\n\r\nFor example at this time I do the following:\r\n\r\n{code}\r\nvar reqUrl = http://api.whatever.com/users/search.json\r\nvar params = { age: 25, sex: male }\r\n...\r\nxhr.open('GET', reqUrl + paramsToUrl(params))\r\nxhr.send()\r\n{code}\r\n\r\nThis results in the following request:\r\n\r\nhttp://api.whatever.com/users/search.json?age=25&sex=male\r\n\r\nIt would be nice to have this supported natively by titanium.\r\n\r\nSo doing this:\r\n\r\n{code}\r\nxhr.open('GET', reqUrl)\r\nxhr.send(params)\r\n{code}\r\n\r\nwould have the same result as my function.\r\n\r\nI think this adds some nice abstraction and a clearer code.\r\n\r\nWhat do you think?\r\n\r\n", "attachment": [], "flagged": false, "summary": "Use data parameter for GET request in httpclient too", "creator": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Any", "comment": { "comments": [ { "id": "265095", "author": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "body": "Let me see if I understand you correctly...\r\n\r\nYou want to change the [xmlHTTPRequest Object |https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest] so the SEND method will QS your params automatically for you?\r\n\r\n", "updateAuthor": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "created": "2013-08-06T14:25:14.000+0000", "updated": "2013-08-06T14:25:39.000+0000" }, { "id": "265097", "author": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "body": "I often had code like this:\r\n\r\n{code}\r\nvar searchParams = {\r\n age: $.ageField.value,\r\n sex: $.sexField.value\r\n}\r\n\r\n\r\nvar request = 'http://api.whatever.com/users/search.json?age=' + searchParams.age + '&sex=' + searchParams.sex\r\n\r\nxhr.open('GET', request)\r\nxhr.send()\r\n{code}\r\n\r\nInstead I wish we could do that:\r\n\r\n{code}\r\nvar searchParams = {\r\n age: $.ageField.value,\r\n sex: $.sexField.value\r\n}\r\n\r\nxhr.open('GET', 'http://api.whatever.com/users/search.json')\r\nxhr.send(searchParams)\r\n{code}\r\n\r\nIt's similar to POST request syntax, and nicer. (o maybe there is something I don't know that could improve what I do)\r\n\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-08-06T14:33:20.000+0000", "updated": "2013-08-06T14:39:11.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }