Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-6828] Setting value as nil removes header from request #15

Merged
merged 2 commits into from Jul 1, 2014
Merged

[TIMOB-6828] Setting value as nil removes header from request #15

merged 2 commits into from Jul 1, 2014

Conversation

vishalduggal
Copy link
Contributor

Fix for TIMOB-6828

[[self headers] removeObjectForKey:key];
} else {
[[self headers] setValue:value forKey:key];
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use Objective-C literals and add debug logging. Something like this:

-(void)addHeaderKey:(NSString*)key andHeaderValue:(NSString*)value
{
    if (key == nil) {
        DebugLog(@"Ignore request to self.headers[%@] = %@", key, value);
        return;
    }

    if (value == nil) {
        DebugLog(@"Remove key %@ from self.headers (previous value of self.headers[%@] was %@", key, key, value);
        [self.headers removeObjectForKey:key];
    } else {
        DebugLog(@"self.headers[%@] = %@", key, value);
        self.headers[key] = value;
    }
}

@pec1985
Copy link
Contributor

pec1985 commented Jul 1, 2014

Code reviewed. Tested with Titanium Mobile. PR APPROVED!

pec1985 added a commit that referenced this pull request Jul 1, 2014
[TIMOB-6828] Setting value as nil removes header from request
@pec1985 pec1985 merged commit 20fb741 into tidev:master Jul 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants