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
1 changed files with 5 additions and 0 deletions

View File

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