ResponseDetective is a non-intrusive framework for intercepting any outgoing requests and incoming responses between your app and your server for debugging purposes.
Requirements
ResponseDetective is written in Swift 5.3 and supports iOS 9.0+, macOS 10.10+ and tvOS 9.0+.
Usage
Incorporating ResponseDetective in your project is very simple – it all comes down to just two steps:
Step 1: Enable interception
For ResponseDetective to work, it needs to be added as a middleman between your (NS)URLSession and the Internet. You can do this by registering the provided URLProtocol class in your session’s (NS)URLSessionConfiguration.protocolClasses, or use a shortcut method:
// Swift
let session = URLSession(configuration: configuration)
Or, if you’re using AFNetworking/Alamofire as your networking framework, integrating ResponseDetective comes down to just initializing your AFURLSessionManager/Manager with the above (NS)URLSessionConfiguration:
If you’re using Carthage, add the following dependency to your Cartfile:
github "netguru/ResponseDetective" ~> {version}
CocoaPods
If you’re using CocoaPods, add the following dependency to your Podfile:
use_frameworks!
pod 'ResponseDetective', '~> {version}'
Swift Package Manager
If you’re using Swift Package Manager, add this repository to the Swift Packages in your project settings.
Local
To install the test dependencies or to build ResponseDetective itself, do not run carthage directly. It can’t handle the Apple Silicon architectures introduced in Xcode 12. Instead, run it through the carthage.sh script:
$ ./carthage.sh bootstrap
Alternatively, you can run the tests locally using Swift Package Manager with the following command:
Starting from version 1.0.0, ResponseDetective’s releases are named after Sherlock Holmes canon stories, in chronological order. What happens if we reach 60 releases and there are no more stories? We don’t know, maybe we’ll start naming them after cats or something.
License
This project is licensed under MIT License. See LICENSE.md for more info.
ResponseDetective is a non-intrusive framework for intercepting any outgoing requests and incoming responses between your app and your server for debugging purposes.
Requirements
ResponseDetective is written in Swift 5.3 and supports iOS 9.0+, macOS 10.10+ and tvOS 9.0+.
Usage
Incorporating ResponseDetective in your project is very simple – it all comes down to just two steps:
Step 1: Enable interception
For ResponseDetective to work, it needs to be added as a middleman between your
(NS)URLSession
and the Internet. You can do this by registering the providedURLProtocol
class in your session’s(NS)URLSessionConfiguration.protocolClasses
, or use a shortcut method:Then, you should use that configuration with your
(NS)URLSession
:Or, if you’re using AFNetworking/Alamofire as your networking framework, integrating ResponseDetective comes down to just initializing your
AFURLSessionManager
/Manager
with the above(NS)URLSessionConfiguration
:And that’s all!
Step 2: Profit
Now it’s time to perform the actual request:
Voilà! 🎉 Check out your console output:
Installation
Carthage
If you’re using Carthage, add the following dependency to your
Cartfile
:CocoaPods
If you’re using CocoaPods, add the following dependency to your
Podfile
:Swift Package Manager
If you’re using Swift Package Manager, add this repository to the Swift Packages in your project settings.
Local
To install the test dependencies or to build ResponseDetective itself, do not run
carthage
directly. It can’t handle the Apple Silicon architectures introduced in Xcode 12. Instead, run it through thecarthage.sh
script:Alternatively, you can run the tests locally using Swift Package Manager with the following command:
About
This project was made with ♡ by Netguru.
Release names
Starting from version 1.0.0, ResponseDetective’s releases are named after Sherlock Holmes canon stories, in chronological order. What happens if we reach 60 releases and there are no more stories? We don’t know, maybe we’ll start naming them after cats or something.
License
This project is licensed under MIT License. See LICENSE.md for more info.