A body containing raw binary data
Allows to send arbitrarily complex JSON data.
A body made of multiple parts.
A body made of multiple parts.
Usage: A multipart body acts as a container for other bodies. For instance, the multipart body is commonly used to send a form with binary attachments in conjunction with the ByteBufferBody. For simple key/value pairs, use URLEncodedBody instead.
Safety consideration: A random boundary is generated to separate parts. If the boundary was to occur within a body part, it would mess up the whole body. In practice, the odds are extremely small though.
Plain text body sent as text/plain
mime type.
An urlencoded HTTP body.
An urlencoded HTTP body.
Usage: urlencoded bodies are best suited for simple key/value maps of strings. For more structured data, use JSONBody. For binary data, use ByteBufferBody or MultiPartBody.
URLEncoded bodies are associated with the mime type "application/x-www-form-urlencoded" and look like query string parameters (eg. key=value&key2=value2 ).
A body containing raw binary data
Usage: Stream bodies are used to send arbitrary binary data such as audio, video or any other file attachment. The content-type can be overridden to something more specific like
image/jpeg
oraudio/wav
for instance. It is common to embed a stream body in a MultiPartBody to send additional information with the binary file. When possible, send aContent-Length
header along with an octet-stream body. It may allow the receiver end to better handle the loading.A stream body is sent with the content-type application/octet-stream.