Java, Kotlin, and Kotest extensions for httptape -- the HTTP traffic recording, sanitization, and replay tool.
This SDK provides Testcontainers integrations that collapse ~50 lines of manual container setup into ~5 lines.
| Module | Description | Language |
|---|---|---|
httptape-testcontainers |
Core HttptapeContainer with fluent Java API |
Java 21+ |
httptape-testcontainers-kotlin |
Kotlin DSL (httptape { ... } builder) on top of the Java core |
Kotlin |
httptape-testcontainers-kotest |
Kotest MountableExtension for lifecycle management |
Kotlin / Kotest 6 |
Note: v0.1.0 is not yet published to Maven Central. The snippets below are placeholders for when it is.
// Java projects
testImplementation("dev.httptape:httptape-testcontainers:0.1.0")
// Kotlin projects
testImplementation("dev.httptape:httptape-testcontainers-kotlin:0.1.0")
// Kotest projects
testImplementation("dev.httptape:httptape-testcontainers-kotest:0.1.0")<dependency>
<groupId>dev.httptape</groupId>
<artifactId>httptape-testcontainers</artifactId>
<version>0.1.0</version>
<scope>test</scope>
</dependency>var container = new HttptapeContainer()
.withFixturesFromClasspath("fixtures/")
.withSseTiming(SseTimingMode.REALTIME);
container.start();
String baseUrl = container.getBaseUrl();val container = httptape {
fixtures("fixtures/")
matcherConfig("httptape.config.json")
sseTiming = SseTimingMode.REALTIME
}
container.start()class MyTest : FreeSpec({
val httptape = install(httptapeExtension {
fixtures("fixtures/")
matcherConfig("httptape.config.json")
})
"my test" {
val url = httptape.baseUrl
// make HTTP requests against the mock server
}
})- JDK 21+
- Docker (for integration tests)
./gradlew buildIf you have this repo checked out as a sibling to the main httptape repo, you can use Gradle composite builds to test the SDK against the demos without publishing:
# In the demo project's settings.gradle.kts:
val sdkDir = file("../../../httptape-jvm")
if (sdkDir.exists()) {
includeBuild(sdkDir) {
dependencySubstitution {
substitute(module("dev.httptape:httptape-testcontainers"))
.using(project(":testcontainers"))
substitute(module("dev.httptape:httptape-testcontainers-kotlin"))
.using(project(":testcontainers-kotlin"))
substitute(module("dev.httptape:httptape-testcontainers-kotest"))
.using(project(":testcontainers-kotest"))
}
}
}For Maven-based projects, publish to local Maven first:
./gradlew publishToMavenLocalApache 2.0 -- see LICENSE.