Project: titanium
Issue TIMOB-20181: iOS: HTTPClient multipart/form-data produces bad content-type headers for individual parts
Appcelerator Command-Line Interface, version 4.1.2 Appcelerator Studio, build: 4.1.1.201507141126 Mac OS X 10.10.4 IDE iOS issue only. I'm using iOS SDK 8.4. Xcode Version 6.4 (6E35b) Android works differently and the web service calls sends out headers that our server understands. Titanium SDK 4.1.0.GA HTTPClient breaks my calls to multipart/form-data web services on my server by adding a "Content-Type" to text parameters that it did not add in SDK 3.5.1.GA. Here is the code that I use. Please note that you will need to create your own "requestb.in" to test this {code:javascript} function getLoader(cbfn, fn) {	var loader = Titanium.Network.createHTTPClient(); var response = { success: false, data: null, errors: [] }; if (fn != null && fn != "")	loader.setFile(fn);	loader.onload = function()	{	loaderResponseInfo(this);	Titanium.API.info('Data request succeeded');	response.data = this.responseData;	cbfn(this, response);	};	loader.onerror = function()	{	loaderResponseInfo(this);	Titanium.API.info('Data request failed');	response.success = false;	if (!('errors' in response))	response.errors = [];	response.errors.push("Error calling webservice");	cbfn(this, response);	};	return loader; } function multipartdata(url, cbfn, params, httpmethod, fn) {	var loader = getLoader(cbfn, fn);	loader.open(httpmethod, url);	loader.onreadystatechange = function()	{ if (loader.readyState === 4) { Ti.API.info("onreadystatechange(" + loader.responseText + ")"); } };	loader.send(params); } function setProfileImage( paramsobj, cbfn ) {	paramsobj.imageType = 'profile-image';	paramsobj.ticket = _qtp.ticket(); // temporary ticket created at login	var url;	// debug sent to a requestbin	url = "http://requestb.in/11w0o7p1";	multipartdata(url, cbfn, paramsobj, 'POST', "");	// Actual web service call	// url = 'https://app.qbos.com/ws/QTP/cs/de9r/v2/imgUpload.cfm';	// multipartdata(url, cbfn, paramsobj, 'POST', ""); } {code} *This is the requestb.in output from Titanium SDK 4.1.0.GA * http://requestb.in POST /11w0o7p1 multipart/form-data; boundary=0xTibOuNdArY_1437747270 414.37 kB 13m ago From 173.57.154.232 FORM/POST PARAMETERS ticket: 8423D076MA0D1MECA5MF8C9D5A5F043C66B imageType: profile-image HEADERS Connect-Time: 1 X-Request-Id: be4c0ddb-a4d6-4b7f-b291-4bf38719a98b Accept: */* X-Titanium-Id: a2feff7e-fa06-4eb9-9555-81a1dbfd5849 Content-Type: multipart/form-data; boundary=0xTibOuNdArY_1437747270 Host: requestb.in User-Agent: Appcelerator Titanium/4.1.0 (iPhone Simulator/8.4; iPhone OS; en_US;) Accept-Language: en-us Accept-Encoding: gzip, deflate Via: 1.1 vegur Connection: close X-Requested-With: XMLHttpRequest Content-Length: 424315 Total-Route-Time: 0 RAW BODY --0xTibOuNdArY_1437747270 Content-Disposition: form-data; name="ticket" Content-Type:text/plain;charset="utf-8" 8423D076MA0D1MECA5MF8C9D5A5F043C66B --0xTibOuNdArY_1437747270 Content-Disposition: form-data; name="imageType" Content-Type:text/plain;charset="utf-8" profile-image --0xTibOuNdArY_1437747270 Content-Disposition: form-data; name="imageFile"; filename="01437747270.jpeg" Content-Type: image/jpeg *Here is the requestb.in output for Titanium SDK 3.5.1.GA * http://requestb.in POST /11w0o7p1 multipart/form-data; charset=utf-8; boundary=0xTibOuNdArY_1437748068 414.29 kB 32s ago From 173.57.154.232 FORM/POST PARAMETERS ticket: 849D5625MA0D1MECA5MF8BB1805CBA271F6 imageType: profile-image HEADERS Connect-Time: 1 X-Request-Id: 9ea9915b-0ca1-4a0b-8c91-baa39b1e777c Accept: */* Via: 1.1 vegur Content-Type: multipart/form-data; charset=utf-8; boundary=0xTibOuNdArY_1437748068 Host: requestb.in User-Agent: Appcelerator Titanium/3.5.1 (iPhone Simulator/8.4; iPhone OS; en_US;) Accept-Language: en-us Accept-Encoding: gzip, deflate X-Titanium-Id: a2feff7e-fa06-4eb9-9555-81a1dbfd5849 Connection: close X-Requested-With: XMLHttpRequest Content-Length: 424233 Total-Route-Time: 0 RAW BODY --0xTibOuNdArY_1437748068 Content-Disposition: form-data; name="ticket" 849D5625MA0D1MECA5MF8BB1805CBA271F6 --0xTibOuNdArY_1437748068 Content-Disposition: form-data; name="imageType" profile-image --0xTibOuNdArY_1437748068 Content-Disposition: form-data; name="imageFile"; filename="01437748068.jpeg" Content-Type: image/jpeg Is there a way to control the individual content-types on a multipart/form-data post? Specifically can I change the text parameters to have "no Content-Type" like it did in 3.5.1?
Story points: 5