Latest 0.1.0
Homepage https://github.com/PB-Tech/PBURLProtocol
License MIT
Platforms ios 8.0, osx 10.8, requires ARC
Dependencies CocoaSecurity
Frameworks Foundation
Authors

This is a iOS network intercepter ,you can you this code mocking you network data ,inclue native code request and webView(WKWebView/UIWebView) request.

CocoaPods

pod 'PBURLProtocol'

Usage

It’s easy to use.

[PBURLProtocol setInterceptRule:^BOOL(NSURLRequest *request) {
    //set up which requet will be block
    return YES;
}];

[PBURLProtocol setRebuildBlock:^NSURLRequest *(NSURLRequest *orignal) {
    //rebuild the request
    NSMutableURLRequest *req = orignal.mutableCopy;
    req.URL = [NSURL URLWithString:@"https://www.google.com"];
    return req;
}];
//custom which scheme will be intercept(just aviable from ios 9.0)
[PBURLProtocol enableScheme:@"http"];
[PBURLProtocol start];

Latest podspec

{
    "name": "PBURLProtocol",
    "version": "0.1.0",
    "summary": "PBURLProtocol",
    "homepage": "https://github.com/PB-Tech/PBURLProtocol",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "PB-Tech": "[email protected]"
    },
    "source": {
        "git": "https://github.com/PB-Tech/PBURLProtocol.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.8"
    },
    "frameworks": "Foundation",
    "source_files": "src/**/*.{m,h}",
    "public_header_files": "src/**/*.h",
    "requires_arc": true,
    "dependencies": {
        "CocoaSecurity": []
    }
}

Pin It on Pinterest

Share This