NetShears
NetShears is a Network interceptor framework written in Swift.
NetShears adds a Request interceptor mechanisms to be able to modify the HTTP/HTTPS Request before being sent . This mechanism can be used to implement authentication policies, add headers to a request , add log trace or even redirect requests.
Features
- [x] Intercept HTTP/HTTPS request header
- [x] Intercept HTTP/HTTPS request endpoint
- [x] View traffic logs
- [ ] Intercept HTTP/HTTPS response body
- [ ] Block HTTP requets
How it works
NetShears working by swizzling the URLProtocol.
How to use
Start NetShears by calling startRecording()
in didFinishLaunchingWithOptions
Interceptor
Header Modification:
Endpoint Modification:
Traffic Monitoring
In order to show network traffics in your app simply call presentNetworkMonitor method and then a view will present containing traffic logs.
gRPC
You can view gRPC calls by constructing the Request and Response from GRPC models:
Example
Installation
Swift Package Manager
Create a Package.swift
file.
CocoaPods
Replace YOUR_TARGET_NAME
and then, in the Podfile
directory, type: