Alamofire supports HTTP ETAG mechanism

I cannot figure out if Alamofire supports HTTP ETAG.

I find this discussion https://github.com/Alamofire/AlamofireImage/issues/5

and another thread:

NSURLCache and ETags

I used to use AFNETWORKING 1.x with Etag, and I found these lines of code:

NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy]; if ([self.response respondsToSelector:@selector(allHeaderFields)] && [[self.response allHeaderFields] valueForKey:@"ETag"]) { [mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"]; } 

In AFHTTPRequestOperation.h (AFNETWORKING 1.xx)

I cannot figure out if Etag will automatically work with the url cache policy:

 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval:60]; 

Or in another way ..

I'm a little bit confused.

+6
source share

All Articles