Exemple #1
0
void DefaultClientHeaders::requestFilter(Context& context,
                                         BaseRequest& request) const
{
    const ClientSessionSettings& settings = context.getClientSessionSettings();

    if (!settings.getUserAgent().empty())
    {
        request.set("User-Agent", settings.getUserAgent());
    }

//    request.set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
//    request.set("Accept-Language", "en-US,en;q=0.8");

    for (const auto& entry: settings.getDefaultHeaders())
    {
        request.set(entry.first, entry.second);
    }
}
void DefaultResponseStreamFilter::requestFilter(BaseRequest& request,
        Context&)
{
    // Set the headers indicating the encodings we can decode.
    request.set(ACCEPT_ENCODING_HEADER, "gzip, deflate");
}