You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val logoBytes:ByteArray=/** file to upload */val body =listOf(
"Title" to name,
)
return"https://url-to-upload"
.httpUpload(body)
// TODO the InlineDataPart should better accept ByteArray instead of String
.add(InlineDataPart(String(logoBytes), "Logo"))
.cUrlString()
will fail with
The inputs have already been written to an output stream and can not be consumed again.
at com.github.kittinunf.fuel.core.requests.UploadBody.writeTo(UploadBody.kt:100)
at com.github.kittinunf.fuel.core.requests.UploadBody.toByteArray(UploadBody.kt:76)
at com.github.kittinunf.fuel.core.requests.RepeatableBody.toByteArray(RepeatableBody.kt:42)
at com.github.kittinunf.fuel.core.extensions.FormattingKt.cUrlString(Formatting.kt:48)
Which is caused in:
fun Request.cUrlString(): String= buildString {
…
// body
body(body.asRepeatable())
val escapedBody =String(body.toByteArray()).replace("\"", "\\\"") <---FAILSHERE on body.toByteArray()
The InlineDataPart provides bytearray, so it is readable again
For input streams, it could just show [input-stream-data] instead of such error
Also notice above, it would be better if InlineDataPart accepted ByteArray
The text was updated successfully, but these errors were encountered:
vojkny
changed the title
Cannot generate curl with .httpUpload()
Cannot generate cUrlString() with .httpUpload()Aug 15, 2024
will fail with
Which is caused in:
[input-stream-data]
instead of such errorAlso notice above, it would be better if InlineDataPart accepted ByteArray
The text was updated successfully, but these errors were encountered: