how 'Accept-Language' header is passed in http in iphone?
How 'Accept-Language' header is passed in http request in iphone? In my http request, t开发者_C百科he header is empty. Is this appended at the framework level ? If so, Is there a way to intercept it and make modifications?
+(NSMutableURLRequest*)assembleHTTPRequestHead:(NSMutableURLRequest *) requester
{
// These are the headers we need, we get ride of everything else
NSArray *headers = [NSArray arrayWithObjects:@"User-Agent", nil];
NSString* appName = [self getAppName];
NSArray *values = [NSArray arrayWithObjects: appName, nil];
// Add our headers
for (NSString *header in headers) {
// We use setValue to overwrite any value in an existing
// header, addValue appends to the values.
id theValue =[values objectAtIndex:[headers indexOfObject:header]];
[requester setValue:theValue forHTTPHeaderField:header ];
AppTrace3(self, @"Added Header", header, theValue);
}
AppTrace2(self, @"assembleHTTPRequestHead done", requester);
return requester;
}
精彩评论