api

http4k / org.http4k.filter / ServerFilters / ReplaceResponseContentsWithStaticFile

ReplaceResponseContentsWithStaticFile

object ReplaceResponseContentsWithStaticFile

Intercepts responses and replaces the contents with contents of the statically loaded resource. By default, this Filter replaces the contents of unsuccessful requests with the contents of a file named after the status code.

Functions

Name Summary
invoke operator fun invoke(loader: ResourceLoader = Classpath(), toResourceName: (Response) -> String? = { if (it.status.successful) null else it.status.code.toString() }): Filter