Beast Logo

PrevUpHomeNext

Fields

The Fields type represents a container that can set or retrieve the fields in a message. Beast provides the basic_fields class which serves the needs for most users. It supports modification and inspection of values. The field names are not case-sensitive.

These statements change the values of the headers in the message passed:

template<class Body>
void set_fields(request<Body>& req)
{
    if(! req.exists("User-Agent"))
        req.insert("User-Agent", "myWebClient");

    if(req.exists("Accept-Charset"))
        req.erase("Accept-Charset");

    req.replace("Accept", "text/plain");
}

User defined Fields types are possible. To support serialization, the type must meet the requirements of FieldSequence. To support parsing using the provided parser, the type must provide the insert member function.


PrevUpHomeNext