Allow to register subclass of DBURLProtocol on to NSURLSessionConfiguration
Closed this issue · 0 comments
m1entus commented
Hey, i have i case where i would like to register our subclass of DBURLProtocol as a default protocol of db_defaultSessionConfiguration
and db_ephemeralSessionConfiguration
in addition to that i would love to allow to have it also here:
+ (void)setupURLProtocol {
[NSURLProtocol registerClass:[DBURLProtocol class]];
}
Can you allow to set custom class as a default URLProtocol ? Can it be as a static Class property.
The use case is that custom library is creating URLSession
and we don't want to intercept their network requests and would like to skip logging when they make an request:
+ (instancetype)db_defaultSessionConfiguration {
NSURLSessionConfiguration *defaultSessionConfiguration = [self db_defaultSessionConfiguration];
NSMutableArray *originalProtocols = [NSMutableArray arrayWithArray:defaultSessionConfiguration.protocolClasses];
[originalProtocols insertObject:[DBURLProtocol class] atIndex:0];
defaultSessionConfiguration.protocolClasses = originalProtocols;
return defaultSessionConfiguration;
}
``