ChaoticHttpHandler

abstract class ChaoticHttpHandler : Function1<request: Request, Response>

Useful for creating HttpHandlers with a built-in Chaos Engine API for enabling and disabling chaos.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Converts this chaos stage to a standard http4k Filter.

Link copied to clipboard
Link copied to clipboard
open operator override fun invoke(request: Request): Response
Link copied to clipboard
fun misbehave(behaviour: Behaviour = ReturnStatus(INTERNAL_SERVER_ERROR)): ChaosEngine
Link copied to clipboard
Link copied to clipboard
fun ChaoticHttpHandler.start(port: Int = this::class.defaultPort, serverConfig: (Int) -> ServerConfig = ::SunHttp): Http4kServer

Convert this ChaoticHttpHandler into a running server, defaulting on a port dependent on the classname.

Link copied to clipboard
fun Stage.then(nextStage: Stage): (Request) -> Filter?

Chain the next ChaosBehaviour to apply when this stage is finished.

Link copied to clipboard
fun Stage.until(trigger: Trigger): Stage

Stop applying the ChaosBehaviour of this stage when the ChaosTrigger fires.

Link copied to clipboard
fun HttpHandler.withChaosApi(engine: ChaosEngine = ChaosEngine(), security: Security = NoSecurity, controlsPath: String = "/chaos", openApiPath: String = "", corsPolicy: CorsPolicy = UnsafeGlobalPermissive, clock: Clock = Clock.systemUTC(), apiName: String = "http4k"): RoutingHttpHandler

Mixin the set of remote Chaos API endpoints to a standard HttpHandler, using the passed ChaosStage. Optionally a Security can be passed to limit access to the chaos controls.