Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piotrpsz/curlex
C++ wrapper for the well-known curl library (written in C).
https://github.com/piotrpsz/curlex
cpp23 curl rest
Last synced: 2 months ago
JSON representation
C++ wrapper for the well-known curl library (written in C).
- Host: GitHub
- URL: https://github.com/piotrpsz/curlex
- Owner: piotrpsz
- License: mit
- Created: 2024-09-10T09:06:00.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-10T12:39:08.000Z (4 months ago)
- Last Synced: 2024-10-01T06:40:59.297Z (3 months ago)
- Topics: cpp23, curl, rest
- Language: C++
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ wrapper for the well-known curl library (written in C).
### Code example
```c++
Curlex cx;
fmt::print("curl version: {}\n", cx.version());
test(cx)
......void test(Curlex& cx) {
auto request = Request()
.scheme("http")
.host("127.0.0.1:3030")
.endpoint("questions")
.add_param("start", "1")
.add_param("end", "400")
.build();if (auto response = cx.GET(request); response) {
fmt::print("-------------------------------------------\n");
fmt::print("response code: {}\n", response->code());
fmt::print("response headers:\n");
for (auto it: response->headers())
fmt::print("\t{}\n", it);
fmt::print("-------------------------------------------\n");
fmt::print("response body:\n");
fmt::print("{}\n", response->body());
}
}
```