<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          aerogear-ios-httpstub網(wǎng)絡(luò)請求處理庫

          聯(lián)合創(chuàng)作 · 2023-09-27 09:27

          aerogear-ios-httpstub 是使用 Swift 編寫的,很小的網(wǎng)絡(luò)請求處理庫。靈感來源于 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)
          
          瀏覽 17
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  www.99超碰 | 老女人AV | 无码一区二区高清 | 欧美成人A级毛片 | 日韩免费网站 |