lib/curl/Easy: add SetRequestBody() overload with std::span

This commit is contained in:
Max Kellermann 2024-02-21 12:05:16 +01:00 committed by Max Kellermann
parent 00cf036d58
commit 541707f9a8

View File

@ -9,6 +9,7 @@
#include <curl/curl.h> #include <curl/curl.h>
#include <cstddef> #include <cstddef>
#include <span>
#include <stdexcept> #include <stdexcept>
#include <string_view> #include <string_view>
#include <utility> #include <utility>
@ -181,6 +182,10 @@ public:
SetOption(CURLOPT_POSTFIELDSIZE, (long)size); SetOption(CURLOPT_POSTFIELDSIZE, (long)size);
} }
void SetRequestBody(std::span<const std::byte> s) {
SetRequestBody(s.data(), s.size());
}
void SetRequestBody(std::string_view s) { void SetRequestBody(std::string_view s) {
SetRequestBody(s.data(), s.size()); SetRequestBody(s.data(), s.size());
} }