From f086444e4a5c37edf7d8c8539ec417c9d3636213 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 16 Sep 2023 22:36:11 +0200 Subject: [PATCH] lib/curl/Easy: add method SetRequestBody(std::string_view) --- src/lib/curl/Easy.hxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/curl/Easy.hxx b/src/lib/curl/Easy.hxx index e7ac2b25e..563c3fa46 100644 --- a/src/lib/curl/Easy.hxx +++ b/src/lib/curl/Easy.hxx @@ -8,9 +8,10 @@ #include -#include -#include #include +#include +#include +#include /** * An OO wrapper for a "CURL*" (a libCURL "easy" handle). @@ -167,6 +168,10 @@ public: SetOption(CURLOPT_POSTFIELDSIZE, (long)size); } + void SetRequestBody(std::string_view s) { + SetRequestBody(s.data(), s.size()); + } + void SetMimePost(const curl_mime *mime) { SetOption(CURLOPT_MIMEPOST, mime); }