Skip to content

Instantly share code, notes, and snippets.

@brcosm
Created July 2, 2012 23:00
Show Gist options
  • Save brcosm/3036248 to your computer and use it in GitHub Desktop.
Save brcosm/3036248 to your computer and use it in GitHub Desktop.
NSURLCache to ignore UIWebView sub-requests
@interface ProxyCache : NSURLCache
@end
@implementation ProxyCache
- (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request {
if ([request.URL.absoluteString hasPrefix:@"https://www.amazon.com/ap/uedata?"]) {
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL
MIMEType:@"text/plain"
expectedContentLength:0
textEncodingName:nil];
return [[NSCachedURLResponse alloc] initWithResponse:response
data:[NSData dataWithData:nil]];
}
return [super cachedResponseForRequest:request];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment