File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
modules/http/src/main/kotlin/com/github/niqdev/ktor/client Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ private enum class Argument {
29
29
ARG_UPLOAD ,
30
30
ARG_DOWNLOAD ;
31
31
}
32
+ private const val ARCHIVE_PATH = " ../../local/archive"
32
33
33
34
fun main (args : Array <String >) {
34
35
when (val validatedConfig = ClientConfig .load()) {
@@ -82,7 +83,7 @@ private suspend fun runUploadClient(config: ClientConfig) {
82
83
formData {
83
84
append(" description" , " ktor logo" )
84
85
append(
85
- " image" , File (" ../../local/archive /kotlin-ktor.png" ).readBytes(),
86
+ " image" , File (" $ARCHIVE_PATH /kotlin-ktor.png" ).readBytes(),
86
87
Headers .build {
87
88
// see ContentType.Image.PNG
88
89
append(HttpHeaders .ContentType , " image/png" )
@@ -114,7 +115,7 @@ private suspend fun runDownloadClient(config: ClientConfig) {
114
115
.parse(response.headers[HttpHeaders .ContentDisposition ].orEmpty())
115
116
.parameter(ContentDisposition .Parameters .FileName )
116
117
117
- val file = File (" ../../local/archive /download-${System .currentTimeMillis()} -$fileName " )
118
+ val file = File (" $ARCHIVE_PATH /download-${System .currentTimeMillis()} -$fileName " )
118
119
file.writeBytes(response.body())
119
120
log.info { " Downloaded ${file.path} " }
120
121
}
You can’t perform that action at this time.
0 commit comments