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

iOS: HTTPClient sets content-length while the body is empty or undefined with GET

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: Release 5.0.2
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      3.4.0 iOS

      Description

      On iOS, when initiating a call with an empty body on the send object, the content length is being set to 0.

      On Android this problem does not seem to occur
      However, as the body is actually empty, it should not set a content length at all.

      Test case:

             config = {
                 onload: _.partial(_response, true),
                 onerror: _.partial(_response, false),
                 ondatastream: progressHandler,
                 onsendstream: progressHandler,
                 onreadystatechange: stateChangeHandler,
                 timeout: options.timeout || 10000
             };
           var httpClient =  Ti.Network.createHTTPClient(config);
           httpClient.open('GET', path);
           httpClient.setRequestHeader("Content-Type", "application/json");
           var body = undefined; //or var body = '';
           httpClient.send(body); 
      

      When this is send, the request header is going to be "content-length: 0", which should not be the case, the header should be omitted.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              topener Rene Pot
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

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

                  Git Source Code