[AC-472] Multipart HTTP request composed with errors
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Won't Fix |
Resolution Date | 2015-10-29T08:59:37.000+0000 |
Affected Version/s | Appcelerator Studio 4.3.1 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Artem Akulshin |
Assignee | Ashraf Abu |
Created | 2015-10-18T07:18:58.000+0000 |
Updated | 2015-10-29T09:00:03.000+0000 |
Description
I send HTTP multipart request with te following code:
thefile=Titanium.Filesystem.getFile(this.filepath_to_upload);
postdata={
name: this.guid,
createDT:this.createDT+"",
session_length:this.session_length+"",
device_model:Titanium.Platform.getModel(),
device_manufacturer:Titanium.Platform.getManufacturer(),
device_osname:Titanium.Platform.getOsname(),
device_version:Titanium.Platform.getVersion(),
device_locale:Titanium.Platform.getLocale(),
result_type:2, //for fitness=0, for science=1, for fitness+science =2
debug:false,
file: thefile
};
client.open("POST", url);
client.setRequestHeader(
'Authorization',
'Basic ' + Ti.Utils.base64encode(auth.username+':'+auth.password)
);
client.setRequestHeader("enctype", "multipart/form-data");
client.send(postdata);
And the app composes inclosed name tags in the request, for example:
---0Yp7DHdqG1dPhejcf_POatQ2DMYKnOxDBeC
Content-Disposition: form-data; name="name
Content-Type: ; charset=UTF-8
Content-Transfer-Encoding: 8bit
52959e65-8c74-c8c0-be18-90f047f5e9b6
---0Yp7DHdqG1dPhejcf_POatQ2DMYKnOxDBeC
Content-Disposition: form-data; name="device_locale
Content-Type: ; charset=UTF-8
Content-Transfer-Encoding: 8bit
en-US
---0Yp7DHdqG1dPhejcf_POatQ2DMYKnOxDBeC
Content-Disposition: form-data; name="debug
Content-Type: ; charset=UTF-8
Content-Transfer-Encoding: 8bit
Only file field are formed correctly.
This appear in all versions of Titanium SDK 5, but if fall back to version 4 or 3 - all works perfectly.
Attachments
The error does not appear under iOS.
[~xvk@mail.ru] You can run
appc ti sdk install -d -b 5_0_X
on terminal to get an updated SDK. This should be fixed with that version of SDK. Let me know if it's working for you.Yes, it is fine with this version. Thank you.
Thanks [~xvk@mail.ru] for the reply. Resolving issue! :)