Created
January 21, 2020 10:10
-
-
Save bitkid/e49c12c63cc4277a6139d3992a16ecb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file.inputStream().buffered().use { | |
httpClient.submitFormWithBinaryData<HttpResponse>(fullUrl, formData { | |
appendInput("file", headersOf(HttpHeaders.ContentDisposition, | |
ContentDisposition.File | |
.withParameter(ContentDisposition.Parameters.Name, file.name) | |
.withParameter(ContentDisposition.Parameters.FileName, file.file.name) | |
.toString())) { | |
it.asInput() | |
} | |
}).also { | |
logger.info { "importing file ${file.name} (${it.status})" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment