Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foxcapades/lib-k-multipart
Kotlin MultiPart BodyPublisher for the JDK HttpClient API.
https://github.com/foxcapades/lib-k-multipart
http httpclient jdk11 kotlin multipart multipart-formdata multipart-uploads
Last synced: 5 days ago
JSON representation
Kotlin MultiPart BodyPublisher for the JDK HttpClient API.
- Host: GitHub
- URL: https://github.com/foxcapades/lib-k-multipart
- Owner: Foxcapades
- License: mit
- Created: 2022-11-04T17:01:44.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-08T15:48:38.000Z (8 months ago)
- Last Synced: 2024-10-17T01:19:26.220Z (20 days ago)
- Topics: http, httpclient, jdk11, kotlin, multipart, multipart-formdata, multipart-uploads
- Language: Kotlin
- Homepage:
- Size: 638 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.adoc
- License: license
Awesome Lists containing this project
README
= K-MultiPart
:source-highlighter: highlightjs
:lib-version: 1.2.1image:https://img.shields.io/github/license/foxcapades/lib-k-multipart[GitHub]
image:https://img.shields.io/badge/docs-dokka-violet[link="https://foxcapades.github.io/lib-k-multipart/dokka/1.2.0/"]
image:https://img.shields.io/badge/jvm-11-purple[Java 11]
image:https://img.shields.io/maven-central/v/io.foxcapades.lib/k-multipart[Maven Central, link="https://search.maven.org/artifact/io.foxcapades.lib/k-multipart"]Kotlin `multipart/form-data` `BodyPublisher` implementation for the
link:https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html[Java `HttpClient` API]..build.gradle.kts
[source, kotlin, subs="verbatim,attributes"]
----
implementation("io.foxcapades.lib:k-multipart:{lib-version}")
----== Usage
[source,kotlin]
----
fun main(args: Array) {
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()
)
}
----== Releases
[%header, cols="1,1,6a"]
|===
| Version | Docs | Notes| v1.2.1
| link:https://foxcapades.github.io/lib-k-multipart/dokka/1.2.0/[Dokka]
| * Corrects issue with encoding of wide unicode characters.
* Adds optional charset indicator for overall request body.| v1.2.0
| link:https://foxcapades.github.io/lib-k-multipart/dokka/1.2.0/[Dokka]
| Adds new extension/mixin methods for the `HttpRequest.Builder` type allowing
direct publishing of `MultiPartBody` instances.| v1.1.0
| link:https://foxcapades.github.io/lib-k-multipart/dokka/1.1.0/[Dokka]
| Adds new methods to enable non-Kotlin JVM languages to use this library.| v1.0.1
| link:https://foxcapades.github.io/lib-k-multipart/dokka/1.0.0/[Dokka]
| Fixes content-type detection for file body parts.| v1.0.0
| link:https://foxcapades.github.io/lib-k-multipart/dokka/1.0.0/[Dokka]
| Initial release.
|===