{ "id": "62682", "key": "TIMOB-2050", "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": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:57:55.000+0000", "created": "2011-04-15T03:09:03.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "httpclient", "xhr" ], "versions": [], "issuelinks": [], "assignee": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:57:55.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}
Seems like Ruby on Rails doesn't like a Content-Type header\nalong side a form-data multipart. It will attempt to convert normal\nform/data key/value pairs into a File Attachment (containing the\nvalue) instead.
\nIn iPhone, this Content-Type header is not present and it works\nfine. So, for normal fields, we should be suppressing this header\nfield to have the same behavior as iOS. Removing this field causes\nit to work OK.
(from [410b2dea89339e948cec2626e1c93822ed556048])\n[#2050 state:fixed-in-qa] fixed android issue\nrelated to POST with Content-Type for a plain form/data field\n\nhttp://github.com/appcelerator/titanium_mobile/commit/410b2dea89339...
How can Thomas reproduce this to move it to a resolved\nstate?
the easiest way is to:
\nbuild a simple RoR app that will print out the values of the\nincoming post fields. the non-file fields should be text
\npost a mixed POST with both a file and key/value pairs
\nThomas, I can also share the customer client code if you'd\nlike.
I verified that this works on 1.5.0, Android 2.2 and 2.1. Here's\nmy Rails controller code:
\n\nclass UploadController < ApplicationController\n def doit\n render :text => \"got #{params[:file]} and also #{params[:hello]}, request:\\n#{request}\"\n end\nend
\n
\nAnd the Titanium code:
\nvar xhr = Titanium.Network.createHTTPClient();\nvar f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'KS_nav_ui.png');
\n
\n\n\n
\nxhr.onerror = function(e) {
\n
\n\n\n
\n
\n\nTi.API.info('IN ERROR ' + e.error);
\n
\n\n\n\n\n
\n};\nxhr.onload = function(e) {\n\n
\nTi.API.info('IN ONLOAD ' + this.responseText);
\n
\n\n\n\n
\n};\n// open the client\nxhr.open('POST','http://10.0.1.91:3000/upload/doit');\n\n
\n// send the data\nxhr.send({image:f,hello:'hello world!',password:'sanford1000',message:'check me out'});\n
closing due to Kevins awesomeness