{ "id": "78159", "key": "AC-2782", "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": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2011-08-10T02:19:34.000+0000", "created": "2011-07-24T20:32:58.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "tguntharp", "key": "tguntharp", "displayName": "Tony Guntharp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:47:41.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": "All requests coming to the server from HTTPClient are GET requests, no matter what I set it to.\r\n\r\nHere is the code: \r\n\r\n{code:javascript}\r\nvar request = Titanium.Network.createHTTPClient();\r\nrequest.open('POST', \"http://test.com\");\r\nrequest.onload = function() {\r\n try {\r\n var content = JSON.parse(this.responseText);\r\n if(content.error == undefined) {\r\n // do some things\r\n } else {\r\n alert(content.error);\r\n }\r\n } catch (err) {\r\n Titanium.API.error(err);\r\n Titanium.UI.createAlertDialog({\r\n message : err,\r\n title : \"Remote Server Error\"\r\n });\r\n }\r\n};\r\nrequest.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\");\r\nrequest.send({ test: 'test'});\r\n{code} \r\n\r\nI've also tried not setting the header and also passing in the data as a string instead of an object. ", "attachment": [ { "id": "21948", "filename": "android.log", "author": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-25T08:17:14.000+0000", "size": 4246, "mimeType": "text/plain" }, { "id": "21947", "filename": "app.js", "author": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-25T08:17:14.000+0000", "size": 765, "mimeType": "application/x-javascript" }, { "id": "21949", "filename": "iphone.txt", "author": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-25T08:17:14.000+0000", "size": 1820, "mimeType": "text/plain" } ], "flagged": false, "summary": "HTTPClient will not send a POST HTTP request", "creator": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Host OS: Mac OS X\r\nOS Arch: x86\r\nJRE Version: 1.6.0_26\r\nJRE Vendor: Apple Inc.\r\nJRE Home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home\r\nInstall Directory: file:/Applications/Titanium Studio/\r\nEclipse Version: 3.6.2.R36x_v20110210\r\nVM Arguments: -Xms40m\r\n-Xmx1024m\r\n-Declipse.p2.unsignedPolicy=allow\r\n-Xdock:icon=../Resources/titanium.icns\r\n-XstartOnFirstThread\r\n-Dorg.eclipse.swt.internal.carbon.smallFonts\r\n-XX:MaxPermSize=256m\r\n-Djava.class.path=/Applications/Titanium Studio/TitaniumStudio.app/Contents/MacOS//../../../plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar\r\n\r\nWorkspace Directory: file:/Users/keith/Documents/Titanium Studio Workspace/\r\nLanguage: en_US\r\n\r\nTitanium Desktop SDK Version: 1.1.0\r\nTitanium Desktop SDK Location: /Library/Application Support/Titanium/sdk/osx/1.1.0\r\n\r\n\r\nTitanium Mobile SDK Version: 1.7.1\r\nMobile SDK Timestamp: 06/21/11 14:28\r\nMobile SDK Build Number: 1293a6d\r\nTitanium Mobile SDK Location: /Library/Application Support/Titanium/mobilesdk/osx/1.7.1\r\n\r\nTitanium Mobile SDK Version: 1.7.2\r\nMobile SDK Timestamp: 07/21/11 09:36\r\nMobile SDK Build Number: 97c3689\r\nTitanium Mobile SDK Location: /Library/Application Support/Titanium/mobilesdk/osx/1.7.2\r\n\r\n", "comment": { "comments": [ { "id": "160431", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Keith\r\n\r\nThe information listed in the environment section seems to imply that you have observed this issue for both mobile AND desktop apps. As I'm able to successfully send POST requests for my own mobile projects, I'd be surprised if that is the case.\r\n\r\nPlease explicitly state whether this relates to iPhone or Android.\r\n\r\nYou need to provide a proper [usecase|http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases], which is concise code that demonstrates the issue and runs without modification when pasted into an app.js file.\r\n\r\nYou also should consult the community via a Q&A question before raising a ticket. Please provide the link to that question.\r\n\r\nPlease read the [Jira Ticket Checklist|http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist] to help you correct this ticket, and before raising any more.\r\n\r\nThanks\r\n\r\n", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-07-25T01:17:50.000+0000", "updated": "2011-07-25T01:17:50.000+0000" }, { "id": "160432", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Also, please provide the log of the failed request. Thanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-07-25T01:19:54.000+0000", "updated": "2011-07-25T01:19:54.000+0000" }, { "id": "160464", "author": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sorry about that. \r\n\r\nI marked the component as Mobile, since I'm only using Titanium Studio for mobile development. \r\n\r\nIt is happening in both the iPhone and Android, emulators and the actual phones. I also cleaned the project's build directory.\r\n\r\nI have attached both the app.js and the log files for when this happens. \r\n\r\nHere is the Q&A link: http://developer.appcelerator.com/question/123135/httpclient-will-not-send-a-post-http-request#comment-91925 This code seems to work fine for other people, so it seems like a weird bug that it's not working for me. How can I see the actual request the code is sending? Thanks.", "updateAuthor": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-25T08:17:14.000+0000", "updated": "2011-07-25T08:17:14.000+0000" }, { "id": "160471", "author": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "body": "So, the following code works:\r\n\r\n{code:javascript}\r\nvar request = Titanium.Network.createHTTPClient();\r\n\r\nrequest.onerror = function(e)\r\n{\r\n Ti.UI.createAlertDialog({title:'Error', message:e.error}).show();\r\n Ti.API.info('IN ERROR ' + e.error);\r\n};\r\nrequest.setTimeout(20000);\r\nrequest.onload = function(e)\r\n{\r\n var content = JSON.parse(this.responseText);\r\n Titanium.API.info(content);\r\n if(content.error == undefined) {\r\n // do some things\r\n alert('worked');\r\n } else {\r\n alert(content.error);\r\n }\r\n};\r\nrequest.onsendstream = function(e)\r\n{\r\n //ind.value = e.progress ;\r\n Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress);\r\n};\r\nrequest.open('POST','http://www.israelnetdaily.com/json.php');\r\n\r\nrequest.send({test:'test',purpose:'newaccount'});\r\n{code}\r\n\r\nSo weird. At least it's working now. ", "updateAuthor": { "name": "keeftm", "key": "keeftm", "displayName": "Keith Miller", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-25T08:42:45.000+0000", "updated": "2011-07-25T08:42:45.000+0000" }, { "id": "162373", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Great work, Keith, glad you fixed it.\r\n\r\nYou can inspect the network traffic using a protocol analyzer, such as [Wireshark|http://www.wireshark.org/].\r\n\r\nCheers", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-10T02:18:37.000+0000", "updated": "2011-08-10T02:18:37.000+0000" }, { "id": "162374", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "User confirmed problem was with code.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-10T02:19:34.000+0000", "updated": "2011-08-10T02:19:34.000+0000" }, { "id": "168257", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Closing due to inactivity.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-10-07T05:48:06.000+0000", "updated": "2011-10-07T05:48:06.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }