Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6828] iOS: Setting request header in HTTPClient to null throws exception

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-07-01T18:49:55.000+0000
Affected Version/sRelease 1.8.0.1, Release 2.0.0, Release 3.3.0
Fix Version/sSprint 2011-51, Release 2.0.0, Release 1.8.1, Release 3.3.0, Release 3.4.0
ComponentsiOS
Labelsmodule_network, qe-manualtest, qe-testadded, regression
ReporterBlain Hamon
AssigneeVishal Duggal
Created2011-12-21T14:19:46.000+0000
Updated2014-08-15T22:59:25.000+0000

Description

During the ASI library upgrade, one of our patches (The one for 890), slipped through the cracks and was not reinstated. The end result is that setRequestHeader(,null) throws an exception instead fo removing the header as documented. To recreate:
var xhr = Titanium.Network.createHTTPClient();
xhr.onerror = function(e){Ti.API.info("ERROR " + e.error);};
xhr.onload = function(){Ti.API.info("Loaded");};

xhr.open('GET','http://www.appcelerator.com');
xhr.setRequestHeader('Authorization',null);
xhr.send();

Comments

  1. Blain Hamon 2011-12-21

    The fix for 4691 caused this regression.
  2. Michael Pettiford 2012-01-12

    Closing issue Tested with Ti Studio 1.0.8.201201101928 Ti Mob SDK 1.9.0.v20120111233134 OSX Lion iPhone 4S, iPad 2 Expected behavior is shown of setting request header to null not causing an exception
  3. jithinpv 2013-11-25

    Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5011
  4. Paras Mishra 2014-06-24

    Issue is reproducible, reopening the issue. It works fine on 3.2.3.GA SDK. Runtime Error occurs as " setObjectForKey: object cannot be nil (Key: Authorization) at app.js (line 1) " Environment used: Tested on: Device : iPhone 5s , iOS version : 7.1.1 SDK: 3.3.0.v20140623161712 CLI version : 3.3.0-rc2 OS : MAC OSX 10.9.2 Alloy: 1.4.0-rc2 ACS: 1.0.14 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201406231625 titanium-code-processor: 1.1.1 XCode : 5.1.1 code used
       var win = Ti.UI.createWindow({
           backgroundColor : '#fff'
       });
       var xhr = Titanium.Network.createHTTPClient();
       		xhr.onerror = function(e) {
       			alert("ERROR " + e.error);
       		};
       		xhr.onload = function() {
       			alert("Loaded");
       		};
       
       		xhr.open('GET', 'http://www.appcelerator.com');
       		xhr.setRequestHeader('Authorization', null);
       		xhr.send();
       		
       win.open();
       
  5. Vishal Duggal 2014-06-30

    Pull pending APSHTTPClient - https://github.com/appcelerator/APSHTTPClient/pull/15 titanium mobile master - https://github.com/appcelerator/titanium_mobile/pull/5874 3_3_X - https://github.com/appcelerator/titanium_mobile/pull/5875
  6. Samuel Dowse 2014-07-03

    Verified fixed on: Appcelerator Studio, build: 3.3.0.201406271159 Titanium SDK, build: 3.3.0.v20140703093313 Titanium CLI, build: 3.3.0-rc4 Alloy: 1.4.0-rc3 iOS Simulator: iPad (7.1) iOS Device: iPhone 5 (7.0.6) Exception is not thrown using the test code provided. Closing.

JSON Source