Skip to content

Commit

Permalink
lib/curl/Easy: add SetRequestBody() overload with std::span
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Apr 10, 2024
1 parent 7f22202 commit f32b137
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/curl/Easy.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <curl/curl.h>

#include <cstddef>
#include <span>
#include <stdexcept>
#include <string_view>
#include <utility>
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit f32b137

Please sign in to comment.