scoop:scoop.http.server:0.1.0
src/request_options.scoop
Selected production source · src/request_options.scoop
1
package scoop.http.server3
import scoop.time.Duration5
/** Immutable limits, deadline and completion observation for one application request. */6
public class HttpRequestOptions internal constructor(7
/** Maximum framed request body bytes, or None for no total input limit. */8
public val bodyLimit: Long? = Some(8388608L),9
/** Maximum bytes collected by aggregate body helpers. */10
public val bufferedBodyLimit: Long = 2097152L,11
/** Total request lifetime, including response execution and structured children. */12
public val deadline: Duration? = None,13
/** Observes the final snapshot after request resources and children have ended. */14
public val onCompleted: ((HttpRequestCompletion) -> Unit)? = None15
) {16
public companion object {17
/** Shared immutable configuration for requests without explicit overrides. */18
public val Default: HttpRequestOptions = HttpRequestOptions()19
}21
init {22
if (present(bodyLimit) && bodyLimit!! < 0L)23
throw IllegalArgumentException(Some("negative request body limit"))24
if (bufferedBodyLimit < 0L)25
throw IllegalArgumentException(Some("negative buffered body limit"))26
requireServerDuration(deadline)27
}28
}