Kotlin multipart/form-data
BodyPublisher
implementation for the
Java HttpClient
API.
build.gradle.kts
implementation("io.foxcapades.lib:k-multipart:1.2.1")
fun main(args: Array<String>) {
val client = HttpClient.newHttpClient()
val body = MultiPart.createBody {
withPart {
fieldName = "foo"
withBody("bar")
}
withPart {
fieldName = "fizz"
withBody(File("buzz"))
}
}
client.send(
HttpRequest.newBuilder(URI(args[0]))
.POST(body)
.build(),
HttpResponse.BodyHandlers.discarding()
)
}
Version | Docs | Notes |
---|---|---|
v1.2.1 |
|
|
v1.2.0 |
Adds new extension/mixin methods for the |
|
v1.1.0 |
Adds new methods to enable non-Kotlin JVM languages to use this library. |
|
v1.0.1 |
Fixes content-type detection for file body parts. |
|
v1.0.0 |
Initial release. |