开发者

how 'Accept-Language' header is passed in http in iphone?

开发者 https://www.devze.com 2023-04-06 04:56 出处:网络
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 ?

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消