@@ -557,18 +557,18 @@ enum Error {
557557
558558``` c++
559559httplib::Headers headers = {
560- { "Accept-Encoding ", "gzip, deflate " }
560+ { "Hello ", "World! " }
561561};
562562auto res = cli.Get(" /hi" , headers);
563563```
564564or
565565``` c++
566- auto res = cli.Get(" /hi" , {{"Accept-Encoding ", "gzip, deflate "}});
566+ auto res = cli.Get(" /hi" , {{"Hello ", "World! "}});
567567```
568568or
569569```c++
570570cli.set_default_headers({
571- { "Accept-Encoding ", "gzip, deflate " }
571+ { "Hello ", "World! " }
572572});
573573auto res = cli.Get("/hi");
574574```
@@ -823,6 +823,21 @@ The server can apply compression to the following MIME type contents:
823823Brotli compression is available with ` CPPHTTPLIB_BROTLI_SUPPORT ` . Necessary libraries should be linked.
824824Please see https://github.com/google/brotli for more detail.
825825
826+ ### Default ` Accept-Encoding ` value
827+
828+ The default ` Acdcept-Encoding ` value contains all possible compression types. So, the following two examples are same.
829+
830+ ``` c++
831+ res = cli.Get(" /resource/foo" );
832+ res = cli.Get(" /resource/foo" , {{"Accept-Encoding", "gzip, deflate, br"}});
833+ ```
834+
835+ If we don't want a response without compression, we have to set `Accept-Encoding` to an empty string. This behavior is similar to curl.
836+
837+ ```c++
838+ res = cli.Get("/resource/foo", {{"Accept-Encoding", ""}});
839+ ```
840+
826841### Compress request body on client
827842
828843``` c++
@@ -834,8 +849,9 @@ res = cli.Post("/resource/foo", "...", "text/plain");
834849
835850``` c++
836851cli.set_decompress(false );
837- res = cli.Get(" /resource/foo" , {{"Accept-Encoding", "gzip, deflate, br"}} );
852+ res = cli.Get(" /resource/foo" );
838853res->body; // Compressed data
854+
839855```
840856
841857Use ` poll ` instead of ` select `
0 commit comments