ResponseDetective 非侵入式框架

程序名称:ResponseDetective

授权协议: MIT

操作系统: iOS

开发语言: Swift

ResponseDetective 介绍

ResponseDetective 是一个非侵入式框架,用于拦截你的应用程序和服务器之间的传出请求和传入的反应,可用于调试。

使用:

Step 1: Register interceptors

// request
InterceptingProtocol.registerRequestInterceptor(BaseInterceptor())
InterceptingProtocol.registerRequestInterceptor(JSONInterceptor())
// response
InterceptingProtocol.registerResponseInterceptor(BaseInterceptor())
InterceptingProtocol.registerResponseInterceptor(JSONInterceptor())
InterceptingProtocol.registerResponseInterceptor(HTMLInterceptor())
// error
InterceptingProtocol.registerErrorInterceptor(BaseInterceptor())

Step 2: Register the protocol

let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
configuration.protocolClasses = [InterceptingProtocol.self]
let session = NSURLSession(configuration: configuration)


let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
configuration.protocolClasses = [InterceptingProtocol.self]
let manager = Alamofire.Manager(configuration: configuration)

Step 3: Profit

let request = NSURLRequest(URL: NSURL(string: "http://httpbin.org/get")!)
let task = session.dataTaskWithRequest(request)
task.resume()

ResponseDetective 官网

https://github.com/netguru/ResponseDetective

相关编程语言

Acapela TTS 是一个为 iPhone 和 iPad 开发的 TTS 引...
二维码(QR Code)扫描静态库,扫描效率较高。
RegexKitLite 是一个轻量级的 Objective-C 的正则表...
一款基于ASIHttpReques开源的仿迅雷多线程断点续传功...
实现动态检测网络(wifi)状况,不需要用户手动刷新...
使用iphoneSDK官方NSXMLParserDelegate做的简单xml解...