Macro anterofit::body [] [src]

macro_rules! body {
    ($body:expr) => { ... };
    (EAGER: $body:expr) => { ... };
}

Serialize the given value as the request body.

Serialization will be performed on the adapter's executor, using the adapter's serializer, when the request is submitted.

If the value is intended to be read directly as the request body, wrap it with RawBody.

By default, serialization will be done on the adapter's executor, so the body type must be Send + 'static.

If you want to serialize borrowed values or other types which cannot be sent to other threads, use the EAGER: contextual keyword, which will cause the body to be immediately serialized on the current thread.

Overwrites Body

Setting a new body will overwrite any previous body on the request.

Panics

If the request is a GET request (cannot have a body).