Project: titanium
Issue TIMOB-18902: HTTPClient: unable set content-type as json for multipart post request using Httpclient
h5.Description: HTTP request sends post to a Salesforce.com REST api that is expecting a multipart request with content-type set clearly for each of the parts, like the following: {quote} POST /services/data/v33.0/chatter/feed-elements HTTP/1.1 Authorization: OAuth 00DRR0000000N0g!... User-Agent: Jakarta Commons-HttpClient/3.0.1 Host: instance_name Content-Length: 845 Content-Type: multipart/form-data; boundary=boundary Accept: application/json --boundary Content-Disposition: form-data; name="json" Content-Type: application/json; charset=UTF-8 { "somejson":"data" } --boundary Content-Disposition: form-data; name="feedElementFileUpload"; filename="receipt.pdf" Content-Type: application/octet-stream; charset=ISO-8859-1 filecontent {quote} If we set xhr.setRequestHeader("enctype", "multipart/form-data"), This is fine for the file part, as Titanium is doing the magic. However, for the json part, Titanium will not set it and hence caused parsing errors for the post request. How can we support that?
Story points: 13