Skip to content

Instantly share code, notes, and snippets.

View e5l's full-sized avatar

Leonid Stashevsky e5l

View GitHub Profile
class Timeouts {
class Config(var postRequestTimeout: Long = 5000L)
companion object : ApplicationFeature<ApplicationCallPipeline, Config, Unit> {
override val key: AttributeKey<Unit> = AttributeKey("Timeouts")
override fun install(pipeline: ApplicationCallPipeline, configure: Config.() -> Unit) {
val postTimeout = Config().apply(configure).postRequestTimeout
if (postTimeout <= 0) return