in order to get both read and write behaviour you ...
# http4k
d
in order to get both read and write behaviour you need to compose 2 filters - one to record and the other to replay:
Copy code
fun `disk cache!`(dir: String): Http4kServer {
    val cache = ReadWriteCache.Disk(dir)
    return ProxyHost(Https)
        .then(RecordTo(cache))
        .then(ServeCachedFrom(cache))
        .then(ReportHttpTransaction { println(it.request.uri) })
        .then(JavaHttpClient())
        .asServer(KtorCIO())
        .start()
}
👍 1