Skip to content

Commit ed1cf8f

Browse files
committed
Cleaner API (breaking change)
1 parent 8794792 commit ed1cf8f

File tree

3 files changed

+260
-512
lines changed

3 files changed

+260
-512
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ auto res = cli.Get("/hi", headers);
563563
```
564564
or
565565
```c++
566-
auto res = cli.Get("/hi", {{"Hello", "World!"}});
566+
auto res = cli.Get("/hi", httplib::Headers{{"Hello", "World!"}});
567567
```
568568
or
569569
```c++
@@ -657,7 +657,7 @@ auto res = cli.Get("/large-data",
657657
std::string body;
658658
659659
auto res = cli.Get(
660-
"/stream", Headers(),
660+
"/stream",
661661
[&](const Response &response) {
662662
EXPECT_EQ(StatusCode::OK_200, response.status);
663663
return true; // return 'false' if you want to cancel the request.
@@ -829,13 +829,13 @@ The default `Acdcept-Encoding` value contains all possible compression types. So
829829

830830
```c++
831831
res = cli.Get("/resource/foo");
832-
res = cli.Get("/resource/foo", {{"Accept-Encoding", "gzip, deflate, br"}});
832+
res = cli.Get("/resource/foo", httplib::Headers{{"Accept-Encoding", "gzip, deflate, br"}});
833833
```
834834
835835
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.
836836
837837
```c++
838-
res = cli.Get("/resource/foo", {{"Accept-Encoding", ""}});
838+
res = cli.Get("/resource/foo", httplib::Headers{{"Accept-Encoding", ""}});
839839
```
840840

841841
### Compress request body on client

0 commit comments

Comments
 (0)