November 2018
Intermediate to advanced
404 pages
10h 16m
English
Besides the setUp() and tearDown() methods in the Kitura test boilerplate code, you'll also find the same code reusing strategy in the extension URLRequest. Extensions in Swift add new functionality to an existing class for which you do not have access to the source code. In the URLRequest extension, the Kitura test boilerplate code extends the class URLRequest in the Swift Foundation library to include URL parsing and handling code specific to the Kitura server environment:
private extension URLRequest { // [1] // [2] init?(forTestWithMethod method: String, route: String = "", body: Data? = nil) { if let url = URL(string: "http://127.0.0.1:\(RouteTests.port)/" + route){ // [3] self.init(url: ...Read now
Unlock full access