Skip to content

Commit

Permalink
Cleaner API (breaking change)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Dec 23, 2024
1 parent 8794792 commit ed1cf8f
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 512 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ auto res = cli.Get("/hi", headers);
```
or
```c++
auto res = cli.Get("/hi", {{"Hello", "World!"}});
auto res = cli.Get("/hi", httplib::Headers{{"Hello", "World!"}});
```
or
```c++
Expand Down Expand Up @@ -657,7 +657,7 @@ auto res = cli.Get("/large-data",
std::string body;
auto res = cli.Get(
"/stream", Headers(),
"/stream",
[&](const Response &response) {
EXPECT_EQ(StatusCode::OK_200, response.status);
return true; // return 'false' if you want to cancel the request.
Expand Down Expand Up @@ -829,13 +829,13 @@ The default `Acdcept-Encoding` value contains all possible compression types. So

```c++
res = cli.Get("/resource/foo");
res = cli.Get("/resource/foo", {{"Accept-Encoding", "gzip, deflate, br"}});
res = cli.Get("/resource/foo", httplib::Headers{{"Accept-Encoding", "gzip, deflate, br"}});
```
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++
res = cli.Get("/resource/foo", {{"Accept-Encoding", ""}});
res = cli.Get("/resource/foo", httplib::Headers{{"Accept-Encoding", ""}});
```

### Compress request body on client
Expand Down
Loading

0 comments on commit ed1cf8f

Please sign in to comment.