Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreysolovyev381/libcurl_cpp_wrapper
Bare minimum libcurl C++ wrapper.
https://github.com/andreysolovyev381/libcurl_cpp_wrapper
cpp curl curl-library http-requests libcurl rest
Last synced: about 1 month ago
JSON representation
Bare minimum libcurl C++ wrapper.
- Host: GitHub
- URL: https://github.com/andreysolovyev381/libcurl_cpp_wrapper
- Owner: andreysolovyev381
- License: mit
- Created: 2024-06-01T21:29:12.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-09-04T21:39:21.000Z (4 months ago)
- Last Synced: 2024-10-16T19:16:01.090Z (3 months ago)
- Topics: cpp, curl, curl-library, http-requests, libcurl, rest
- Language: C++
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Bare minimum C++ libcurl wrapper
### Rational
This is a C++ MINI wrapper for well known C-library "libcurl". Wrapper makes a query and gets a text or the simplest json as a result. No performance but extreme simplicity - basically makes GET, PUT queries and gets back the chars.See the tests for the details and examples.
### Kudos
To [magnificent Vinnie Falco](https://github.com/vinniefalco), his contribution to Boost for broader subject.### Dependency
* C++20
* libcurl### Details
Allows to manage:
* url, ie insert something in the middle - in case it deals with some kind of REST API
* request headers
* request methods```cpp
#include "curl_client.h"
...
std::string const test_url {"https://httpbin.org/get"};
curl_client::request request;
curl_client::response response = request.
setURL(test_url)->
implement(curl_client::Method::Get);
curl_client::Print(response, std::cout);
...
```
For more examples see the ./test folder### Testing
Done using this special purpose and very nice [website](https://httpbin.org/). Indeed, there is no guarantee it stays online forever.### Usage
* Copy-paste ./curl_client into your source dir. ```add_subdirectory(curl_client)``` is expected
* Then link curl_client lib into your project, see ./tests/CMakeLists.txt as an example:
```CMake
target_link_libraries(${TESTS_NAME}
${GTEST_LIBRARIES}
curl_client
)
```### License
MIT