[AC-2097] iOS: Network.HTTPClient is cleaning all request headers
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-02-06T18:12:43.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | bug, headers, http, ios, network |
Reporter | Rafael Kellermann Streit |
Assignee | Mauro Parra-Miranda |
Created | 2013-02-06T17:15:16.000+0000 |
Updated | 2016-03-08T07:41:04.000+0000 |
Description
I'm working in a application that have this request:
var xhr = Ti.Network.createHTTPClient();
xhr.setRequestHeader("foo", "bar");
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.open("POST", "http://foo.bar");
xhr.send("Foobar");
But I'm having some problems with it (and other people too: http://developer.appcelerator.com/question/147651/setrequestheader-doesnt-work).
In *TiNetworkHTTPClientProxy.m* we have this following statement (line 384):
-(void)open:(id)args
{
...
request = [[ASIFormDataRequest requestWithURL:url] retain];
...
}
I think this is cleaning all headers included in request. Am i correctly?
So, I changed the code to (because the request already exists):
[request requestWithURL:url];
And it works fine. If I'm correctly, I will make a PR ASAP to titanium_mobile project.
Sorry, apparently I'm wrong. :-(
Could you elaborate?
If I put the request headers after the "open" statement, it will works fine, because of request instance will exists.
Thanks, I'll close it now.
Invalid issue.