Multipart forms

Installation (Gradle)

dependencies {


Multipart form support for fields and files, including a set of lens extensions for fields/files.

See the how-to guides for example use.

Receiving Binary content with http4k Contracts

With binary attachments, you need to turn ensure that the pre-flight validation does not eat the stream. This is possible by instructing http4k to ignore the incoming body for validation purposes:

routes += "/api/document-upload" meta {
    preFlightExtraction = PreFlightExtraction.IgnoreBody
} bindContract POST to { req -> Response(OK) }