| Home | Libraries | People | FAQ | More

##### http::message::prepare_payload

Prepare the message payload fields for the body.

###### Synopsis

    void
    prepare_payload();

###### Description

This function will adjust the Content-Length and Transfer-Encoding field values based on the properties of the body.

###### Example

    request<string_body> req{verb::post, "/" };
    req.set(field::user_agent, "Beast" );
    req.body() = "Hello, world!" ;
    req.prepare_payload();

###### Remarks

This function is not necessary to call in the following situations:

- The request doesn't contain a body, such as in a GET or HEAD request.
- The Content-Length and Transfer-Encoding are set manually.