All Projects → netguru → Responsedetective

netguru / Responsedetective

Licence: mit
This project was made with ♡ by Netguru.

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Responsedetective

Sniffer
Networking activity logger for Swift
Stars: ✭ 108 (-94.38%)
Mutual labels:  tvos, debugging
Xcglogger
A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.
Stars: ✭ 3,710 (+93.13%)
Mutual labels:  tvos, debugging
Clarify
Remove nodecore related stack trace noise
Stars: ✭ 140 (-92.71%)
Mutual labels:  debugging
Metal Tutorial
Metal入门资料,涉及到iOS平台,OSX平台,TvOS平台,其中,OSX平台可以直接运行,iOS平台,TvOS平台都需要使用真机设备测试运行。下面是相关博客,欢迎拍砖
Stars: ✭ 156 (-91.88%)
Mutual labels:  tvos
Watchdog
Class for logging excessive blocking on the main thread
Stars: ✭ 1,802 (-6.19%)
Mutual labels:  debugging
Frodo2
Android Library for Logging RxJava2 Components
Stars: ✭ 142 (-92.61%)
Mutual labels:  debugging
Berkanansdk
Bluetooth mesh messaging SDK for apps
Stars: ✭ 150 (-92.19%)
Mutual labels:  tvos
Loom
Easier to read LuaJIT dumps
Stars: ✭ 138 (-92.82%)
Mutual labels:  debugging
Redbug
erlang tracing debugger
Stars: ✭ 159 (-91.72%)
Mutual labels:  debugging
Color
Color utilities for macOS, iOS, tvOS, and watchOS
Stars: ✭ 145 (-92.45%)
Mutual labels:  tvos
Pdb
A parser for Microsoft PDB (Program Database) debugging information
Stars: ✭ 156 (-91.88%)
Mutual labels:  debugging
Inappviewdebugger
A UIView debugger (like Reveal or Xcode) that can be embedded in an app for on-device view debugging
Stars: ✭ 1,805 (-6.04%)
Mutual labels:  debugging
Wonolog
Monolog-based logging package for WordPress.
Stars: ✭ 142 (-92.61%)
Mutual labels:  debugging
Mamba
Mamba is a Swift iOS, tvOS and macOS framework to parse, validate and write HTTP Live Streaming (HLS) data.
Stars: ✭ 151 (-92.14%)
Mutual labels:  tvos
Strace Pipes Presentation
Presentation: Debugging across pipes and sockets with strace
Stars: ✭ 142 (-92.61%)
Mutual labels:  debugging
Vimspector
vimspector - A multi-language debugging system for Vim
Stars: ✭ 2,711 (+41.12%)
Mutual labels:  debugging
Ducttape
📦 KeyPath dynamicMemberLookup based syntax sugar for Swift.
Stars: ✭ 138 (-92.82%)
Mutual labels:  tvos
Down
Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Stars: ✭ 1,895 (-1.35%)
Mutual labels:  tvos
Noticeobservekit
NoticeObserveKit is type-safe NotificationCenter wrapper.
Stars: ✭ 147 (-92.35%)
Mutual labels:  tvos
Swifthttpstatuscodes
Swift enum wrapper for easier handling of HTTP status codes.
Stars: ✭ 159 (-91.72%)
Mutual labels:  tvos

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:

// Objective-C

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
[RDTResponseDetective enableInConfiguration:configuration];
// Swift

let configuration = URLSessionConfiguration.default
ResponseDetective.enable(inConfiguration: configuration)

Then, you should use that configuration with your (NS)URLSession:

// Objective-C

NSURLSession *session = [[NSURLSession alloc] initWithConfiguration:configuration];
// 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:

// Objective-C (AFNetworking)

AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
// Swift (Alamofire)

let manager = Alamofire.SessionManager(configuration: configuration)

And that's all!

Step 2: Profit

Now it's time to perform the actual request:

// Objective-C

NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://httpbin.org/get"]];
[[session dataTaskWithRequest:request] resume];
// Swift

let request = URLRequest(URL: URL(string: "http://httpbin.org/get")!)
session.dataTask(with: request).resume()

Voilà! 🎉 Check out your console output:

<0x000000000badf00d> [REQUEST] GET https://httpbin.org/get
 ├─ Headers
 ├─ Body
 │ <none>

<0x000000000badf00d> [RESPONSE] 200 (NO ERROR) https://httpbin.org/get
 ├─ Headers
 │ Server: nginx
 │ Date: Thu, 01 Jan 1970 00:00:00 GMT
 │ Content-Type: application/json
 ├─ Body
 │ {
 │   "args" : {
 │   },
 │   "headers" : {
 │     "User-Agent" : "ResponseDetective\/1 CFNetwork\/758.3.15 Darwin\/15.4.0",
 │     "Accept-Encoding" : "gzip, deflate",
 │     "Host" : "httpbin.org",
 │     "Accept-Language" : "en-us",
 │     "Accept" : "*\/*"
 │   },
 │   "url" : "https:\/\/httpbin.org\/get"
 │ }

Installation

Carthage

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}'

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

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].