C++ Requests wraps libcurl with concise C++17 APIs for GET, POST, auth, proxies, and async calls. It can be linked via CMake FetchContent, packages, or system installs.
Overview
C++ Requests (cpr) is a library that wraps libcurl to make HTTP calls more idiomatic in modern C++. It was inspired by Python's Requests project and targets developers who want fewer low-level curl mistakes while keeping libcurl underneath.
The API covers common verbs, custom headers, URL-encoded and multipart bodies, file uploads, several authentication modes, cookies, proxies, timeouts, callbacks, and asynchronous requests. HTTPS can use OpenSSL or WinSSL; Server-Sent Events and thread-safe libcurl access are also supported.
Integration paths include CMake FetchContent, find_package after install, Bazel modules, vcpkg, Conan, Meson wraps, Linux distribution packages, a Windows NuGet build, and MacPorts on macOS. Dependencies beyond a C++17 compiler are mainly OpenSSL when HTTPS is required.
Documentation and examples illustrate simple GET flows contrasted with raw libcurl code. Maintainers note that using a system libcurl requires a sufficiently recent version when not bundling curl.
Key features
- libcurl wrapper with concise API
- GET POST PUT DELETE and more
- Basic digest NTLM bearer auth
- Multipart and file uploads
- Async requests and callbacks
- Proxy and cookie support
- OpenSSL or WinSSL HTTPS
- CMake vcpkg Conan packaging
Use cases
- REST clients in C++ services
- Downloading APIs from native tools
- Replacing verbose libcurl calls
- HTTPS integrations on Windows
- Embedded HTTP in CMake projects