lib/curl/Easy: add method SetRequestBody(std::string_view)

This commit is contained in:
Max Kellermann 2023-09-16 22:36:11 +02:00
parent b8210bbc45
commit f086444e4a

View File

@ -8,9 +8,10 @@
#include <curl/curl.h>
#include <utility>
#include <stdexcept>
#include <cstddef>
#include <stdexcept>
#include <string_view>
#include <utility>
/**
* 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);
}