Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-18902

HTTPClient: unable set content-type as json for multipart post request using Httpclient

    Details

    • Story Points:
      13
    • Sprint:
      2015 Sprint 16 SDK

      Description

      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:

      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

      Unknown macro: { "somejson"}

      --boundary
      Content-Disposition: form-data; name="feedElementFileUpload"; filename="receipt.pdf"
      Content-Type: application/octet-stream; charset=ISO-8859-1

      filecontent

      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?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cng Chee Kiat Ng (Inactive)
                Reporter:
                sliang Shuo Liang
                Reviewer:
                Pedro Enrique (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-19914
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code