Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to register subclass of DBURLProtocol on to NSURLSessionConfiguration #50

Closed
m1entus opened this issue Jul 8, 2021 · 0 comments
Closed

Comments

@m1entus
Copy link
Contributor

m1entus commented Jul 8, 2021

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;
}
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants