[TIMOB-18341] iOS: HTTPClient - Content-Type header is malformed when making a multipart/form-data POST request
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-02-12T08:57:11.000+0000 |
| Affected Version/s | Release 3.4.1, Release 3.5.0 |
| Fix Version/s | Release 4.0.0 |
| Components | iOS |
| Labels | qe-3.5.0 |
| Reporter | Wilson Luu |
| Assignee | Ingo Muschenetz |
| Created | 2015-01-07T23:02:51.000+0000 |
| Updated | 2015-02-12T08:57:11.000+0000 |
Description
*Details:* Content-Type header is malformed when making a multipart/form-data POST request.
*Note:* This is *not a regression* as this occurs in 3.4.1.GA.
*Steps to reproduce:*
1. Create a Titanium app with the app.js attachment and include cricket.wav attachment in the Resources folder
2. In app.js, on line 13, replace
<MACHINE_IP> with your machine's IP address; your device and machine should be on the same wifi network
3. Install app to device
4. Next, download local_server.js attachment and run it via terminal: node local_server.js
5. In the app, press the button
*Actual:* In terminal, the boundary parameter is not immediately after Content-Type multipart/form-data:
$ node local_server.js
headers: {
"host": "172.16.3.225:1337",
"x-titanium-id": "962dd664-7f04-4340-8273-1c0e7d4b4b51",
"x-requested-with": "XMLHttpRequest",
"accept": "*/*",
"content-type": "multipart/form-data; charset=utf-8; boundary=0xTibOuNdArY_1420671499",
"content-length": "81078",
"accept-language": "en-us",
"accept-encoding": "gzip, deflate",
"connection": "keep-alive",
"user-agent": "Appcelerator Titanium/3.4.1 (iPhone/8.1; iPhone OS; en_US;)"
}
*Expected:* The boundary parameter should be immediately after Content-Type multipart/form-data
Attachments
| File | Date | Size |
|---|---|---|
| app.js | 2015-01-07T23:02:51.000+0000 | 826 |
| cricket.wav | 2015-01-07T23:02:51.000+0000 | 80923 |
| local_server.js | 2015-01-07T23:02:51.000+0000 | 240 |
PR by community member https://github.com/appcelerator/APSHTTPClient/pull/19 Reviewing it...
Verified with below Test Environment: 1. Mac OSX Yosemite 10.10 2. Appcelerator Studio, build: 4.0.0.201502111458 3. Titanium SDK, build: 4.0.0.v20150211151855 4. Titanium CLI, build: 3.6.0-dev 5. Alloy: 1.5.1 6. iPhone 6+ with iOS 8.1 Content-Type header is not malformed as the boundary parameter is immediately after Content-Type multipart/form-data as shown in terminal.
Closing this ticket.headers: { "host": "192.168.0.109:1337", "content-type": "multipart/form-data;boundary=0xTibOuNdArY_1423730453", "accept-language": "en-us", "accept-encoding": "gzip, deflate", "connection": "keep-alive", "accept": "*/*", "user-agent": "Appcelerator Titanium/4.0.0 (iPhone/8.1; iPhone OS; en_SG;)", "content-length": "81078", "x-titanium-id": "61f383d9-0410-4b39-8127-92dce821040c", "x-requested-with": "XMLHttpRequest" }Reopened issue for changing the comment code.