Created
June 18, 2020 12:20
-
-
Save stevencurtis/fc39c2ee383b4b70a5cbc11fbd3c5645 to your computer and use it in GitHub Desktop.
URLProtocolMockInstance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let data = jsonString.data(using: .utf8) | |
URLProtocolMock.requestHandler = { request in | |
let response = HTTPURLResponse(url: URL(fileURLWithPath: ""), statusCode: 200, httpVersion: nil, headerFields: nil)! | |
return (response, data) | |
} | |
let configuration = URLSessionConfiguration.af.default | |
configuration.protocolClasses = [URLProtocolMock.self] + (configuration.protocolClasses ?? []) | |
let session = Session(configuration: configuration) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment