Skip to content

Commit 073a5a1

Browse files
committed
update http client
1 parent 7e5c3bb commit 073a5a1

File tree

1 file changed

+3
-2
lines changed
  • modules/http/src/main/kotlin/com/github/niqdev/ktor/client

1 file changed

+3
-2
lines changed

modules/http/src/main/kotlin/com/github/niqdev/ktor/client/Application.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private enum class Argument {
2929
ARG_UPLOAD,
3030
ARG_DOWNLOAD;
3131
}
32+
private const val ARCHIVE_PATH = "../../local/archive"
3233

3334
fun main(args: Array<String>) {
3435
when (val validatedConfig = ClientConfig.load()) {
@@ -82,7 +83,7 @@ private suspend fun runUploadClient(config: ClientConfig) {
8283
formData {
8384
append("description", "ktor logo")
8485
append(
85-
"image", File("../../local/archive/kotlin-ktor.png").readBytes(),
86+
"image", File("$ARCHIVE_PATH/kotlin-ktor.png").readBytes(),
8687
Headers.build {
8788
// see ContentType.Image.PNG
8889
append(HttpHeaders.ContentType, "image/png")
@@ -114,7 +115,7 @@ private suspend fun runDownloadClient(config: ClientConfig) {
114115
.parse(response.headers[HttpHeaders.ContentDisposition].orEmpty())
115116
.parameter(ContentDisposition.Parameters.FileName)
116117

117-
val file = File("../../local/archive/download-${System.currentTimeMillis()}-$fileName")
118+
val file = File("$ARCHIVE_PATH/download-${System.currentTimeMillis()}-$fileName")
118119
file.writeBytes(response.body())
119120
log.info { "Downloaded ${file.path}" }
120121
}

0 commit comments

Comments
 (0)