post

abstract fun post(): Request.Builder

Sets the request method to Method.Post.

Since

200.2.0


abstract fun post(name: String, filename: String, data: ByteArray, contentType: String? = null): Request.Builder

Creates a multipart POST request with the given parameters, representing the data of the request's body part.

Since

200.2.0

Parameters

name

the identifier associated with the data being sent. The name to be used in the HTTP Content-Disposition header, for example: Content-Disposition: form-data; name="image"; filename="logo-square.png"

filename

the file name associated with the data being sent. The filename to be used in in the HTTP Content-Disposition header

data

the byte array containing the actual raw binary data to be sent in the POST request

contentType

an optional parameter representing the content type of the data being sent. The contentType allows you to specify the desired Content-Type header value for the request. It should be in the format of media-type/subtype, for example, image/gif or text/plain.