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

Headers being forcibly set to lower case #46

Open
nathan-fiscaletti opened this issue Jun 23, 2018 · 1 comment
Open

Headers being forcibly set to lower case #46

nathan-fiscaletti opened this issue Jun 23, 2018 · 1 comment

Comments

@nathan-fiscaletti
Copy link

nathan-fiscaletti commented Jun 23, 2018

This piece of code in UNIHTTPRequest.m is forcibly setting all header keys to lower case. This is causing problems with the remote API I'm using as it's custom headers are case sensitive. I don't understand why this would be a thing in the first place.

The code that's causing the issue:

NSMutableDictionary* lowerCaseHeaders = [[NSMutableDictionary alloc] init];
if (headers != nil) {
    for(id key in headers) {
        id value = [headers objectForKey:key];
        [lowerCaseHeaders setObject:value forKey:[key lowercaseString]];
    }
}
[self setHeaders:lowerCaseHeaders];

I fixed it by changing this to

[self setHeaders:headers];

I feel that this should either be an option that you can turn on/off, or you should leave it entirely up to the end user. Someone implementing this should have a clear indications that the header keys are forcibly set to lower case and be able to turn it off if they want.

@nathan-fiscaletti
Copy link
Author

As I post this I realize that this library hasn't been updated in 3 years. Well, in case anyone else runs into this same issue, at least you know why now ;)

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

No branches or pull requests

1 participant