val token = ...
val yourFile = ...
val response = httpPost {
url("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart")
header {
"Authorization" to "Bearer $token"
}
multipartBody {
+FormDataPart("meta", null, RequestBody.create(
MediaType.get("application/json"),
json {
"name" to "supercat"
}
))
+form("image", yourFile)
}
}
FormDataPart primitive is not user-friendly.
Would be nice to have an easy one-liner for part of multipart body.
Would be nice to produce a body { } part the same way as in mono-body request.
At the moment multipart requests look like this:
FormDataPart
primitive is not user-friendly. Would be nice to have an easy one-liner forpart
of multipart body. Would be nice to produce abody { }
part the same way as in mono-body request.Also good to check
uploadType=resumable
from Google Drive API v3See #125