phong le
03/02/2023, 2:34 AMAleksei Tirman [JB]
03/02/2023, 6:39 AMusePreconfiguredSession
method inside the engine
block. Here is an example:
val client = HttpClient(Darwin) {
val delegate = KtorNSURLSessionDelegate()
val session = NSURLSession.sessionWithConfiguration(
NSURLSessionConfiguration.defaultSessionConfiguration(),
delegate,
delegateQueue = NSOperationQueue()
)
engine {
usePreconfiguredSession(session, delegate)
}
}
phong le
03/02/2023, 8:34 AM2.1.0
, also using handleChallenge
AND configureSession
in HttpClient(Darwin).
Following by new version ktor
https://api.ktor.io/ktor-client/ktor-client-darwin/io.ktor.client.engine.darwin/-darwin-client-engine-config/use-preconfigured-session.html
"Set a session to be used to make HTTP requests. If the preconfigured session is set, configureSession and handleChallenge blocks will be ignored."
Do you have any suggestions?
cc @Hien Nguyen @Trương Anh NgocAleksei Tirman [JB]
03/13/2023, 12:28 PMKtorNSURLSessionDelegate
is internal so there is no way to pass the ChallengeHandler
to it.phong le
03/16/2023, 3:23 AMpublic fun configureSessionDelegate(block: NSURLSessionDelegate.() -> Unit)
How about your ideals @Aleksei Tirman [JB]?
cc @Hien Nguyen @Trương Anh Ngoc @Hung Luong @StoneyAleksei Tirman [JB]
03/16/2023, 7:01 AMphong le
03/21/2023, 3:13 AM