mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-24 10:57:15 +00:00
Update README Get() examples to disambiguate Headers overload
This commit is contained in:
committed by
GitHub
parent
c9f8168913
commit
388625174f
@@ -996,7 +996,7 @@ auto res = cli.Get("/hi", headers);
|
|||||||
or
|
or
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
auto res = cli.Get("/hi", {{"Hello", "World!"}});
|
auto res = cli.Get("/hi", httplib::Headers{{"Hello", "World!"}});
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
@@ -1240,7 +1240,7 @@ for details and for reading the variable from the environment.
|
|||||||
```cpp
|
```cpp
|
||||||
httplib::Client cli("httpcan.org");
|
httplib::Client cli("httpcan.org");
|
||||||
|
|
||||||
auto res = cli.Get("/range/32", {
|
auto res = cli.Get("/range/32", httplib::Headers{
|
||||||
httplib::make_range_header({{1, 10}}) // 'Range: bytes=1-10'
|
httplib::make_range_header({{1, 10}}) // 'Range: bytes=1-10'
|
||||||
});
|
});
|
||||||
// res->status should be 206.
|
// res->status should be 206.
|
||||||
@@ -1364,13 +1364,13 @@ The default `Accept-Encoding` value contains all possible compression types. So,
|
|||||||
|
|
||||||
```c++
|
```c++
|
||||||
res = cli.Get("/resource/foo");
|
res = cli.Get("/resource/foo");
|
||||||
res = cli.Get("/resource/foo", {{"Accept-Encoding", "br, gzip, deflate, zstd"}});
|
res = cli.Get("/resource/foo", httplib::Headers{{"Accept-Encoding", "br, gzip, deflate, zstd"}});
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
res = cli.Get("/resource/foo", {{"Accept-Encoding", ""}});
|
res = cli.Get("/resource/foo", httplib::Headers{{"Accept-Encoding", ""}});
|
||||||
```
|
```
|
||||||
|
|
||||||
### Compress request body on client
|
### Compress request body on client
|
||||||
|
|||||||
Reference in New Issue
Block a user