scoop:scoop.http.client:0.1.0
src/authentication/http_authentication_options_builder.scoop
Selected production source · src/authentication/http_authentication_options_builder.scoop
1
package scoop.http.client3
import scoop.collections.emptyList4
import scoop.http.HttpAuthChallenge5
import scoop.url.Url6
import scoop.url.UrlOrigin7
import scoop.http.*8
import scoop.http.asyncio.*9
import scoop.asyncio.*11
/** Configures one complete value; execution remains explicit. */12
public fun httpAuthenticationOptions(13
configure: HttpAuthenticationOptionsBuilder.() -> Unit = {}14
): HttpAuthenticationOptions {15
val builder = HttpAuthenticationOptionsBuilder()16
builder.configure()17
return builder.snapshot()18
}20
public fun HttpAuthenticationOptions.copy(21
configure: HttpAuthenticationOptionsBuilder.() -> Unit = {}22
): HttpAuthenticationOptions {23
val builder = HttpAuthenticationOptionsBuilder()24
builder.providers = this.providers25
builder.maxAttempts = this.maxAttempts26
builder.configure()27
return builder.snapshot()28
}30
public class HttpAuthenticationOptionsBuilder internal constructor() {31
public var providers: List<HttpAuthenticator> = emptyList<HttpAuthenticator>()32
public var maxAttempts: Long = 3L34
public fun provider(value: HttpAuthenticator): Unit {35
val next = ArrayList<HttpAuthenticator>()36
for (item in providers)37
next.add(item)38
next.add(value)39
providers = next.toArray()40
}41
internal fun snapshot(): HttpAuthenticationOptions =42
HttpAuthenticationOptions(providers, maxAttempts)43
}