request

open suspend override fun request(endpoint: String, path: String, filePaths: List<String>, connectionTimeout: Long, socketTimeout: Long, callback: (Int) -> Unit?, boundary: String): ByteArray

Send a HTTP request of multipart post and receive the response.

Return

body of the response

Parameters

endpoint

endpoint of Web API, eg. "http://192.198.1.1:80/"

path

request target of HTTP

filePaths

Content of each part

connectionTimeout

timeout for connection (millisecond).

socketTimeout

timeout for socket (millisecond).

callback

function to pass the percentage of sent firmware

boundary

boundary parameter of multipart/form-data

Throws

when the host returns an error.