aerogear-ios-httpstub
- 授权协议: Apache
- 开发语言: Swift
- 操作系统: iOS
- 软件首页: https://github.com/aerogear/aerogear-ios-httpstub
- 官方下载: https://github.com/aerogear/aerogear-ios-httpstub
软件介绍
aerogear-ios-httpstub 是使用 Swift 编写的,很小的网络请求处理库。灵感来源于 OHHTTPStubs。
使用示例:
// set up http stub
StubsManager.stubRequestsPassingTest({ (request: NSURLRequest!) -> Bool in
return true
}, withStubResponse:( { (request: NSURLRequest!) -> StubResponse in
return StubResponse(data:NSData.data(), statusCode: 200, headers: ["Content-Type" : "text/json"])
}))
// async test expectation
let registrationExpectation = expectationWithDescription("testStubWithNSURLSessionDefaultConfiguration");
let request = NSMutableURLRequest(URL: NSURL(string: "http://server.com"))
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let session = NSURLSession(configuration: config)
let task = session.dataTaskWithRequest(request) {(data, response, error) in
XCTAssertNil(error, "unexpected error")
XCTAssertNotNil(data, "response should contain data")
registrationExpectation.fulfill()
}
task.resume()
waitForExpectationsWithTimeout(10, handler: nil)
About Face 3
Alan Cooper、Robert Reimann、David Cronin / John Wiley & Sons / 2007-5-15 / GBP 28.99
* The return of the authoritative bestseller includes all new content relevant to the popularization of how About Face maintains its relevance to new Web technologies such as AJAX and mobile platforms......一起来看看 《About Face 3》 这本书的介绍吧!
