@@ -50,7 +50,7 @@ struct Tiny {
50
50
}
51
51
52
52
[[nodiscard]]
53
- std::string toString () const {
53
+ std::string to_string () const {
54
54
std::ostringstream ss;
55
55
ss << value ();
56
56
return ss.str ();
@@ -96,18 +96,18 @@ using QueryParameters = std::vector<std::pair<QueryParameterKey, QueryParameterV
96
96
97
97
inline static const std::string WHITESPACE = " \n\t\f\v\r " ;
98
98
99
- inline static std::string leftTrim (const std::string &candidate) {
99
+ inline static std::string left_trim (const std::string &candidate) {
100
100
size_t start = candidate.find_first_not_of (WHITESPACE);
101
101
return (start == std::string::npos) ? " " : candidate.substr (start);
102
102
}
103
103
104
- inline static std::string rightTrim (const std::string &candidate) {
104
+ inline static std::string right_trim (const std::string &candidate) {
105
105
size_t end = candidate.find_last_not_of (WHITESPACE);
106
106
return (end == std::string::npos) ? " " : candidate.substr (0 , end + 1 );
107
107
}
108
108
109
109
inline static std::string trim (const std::string &candidate) {
110
- return rightTrim ( leftTrim (candidate));
110
+ return right_trim ( left_trim (candidate));
111
111
}
112
112
113
113
inline static std::vector<std::string> vec (const std::string& candidate, const char separator) {
@@ -354,6 +354,12 @@ inline static Predicate<HttpStatusCode> server_error() {
354
354
return between_inclusive (INTERNAL_SERVER_ERROR, NETWORK_AUTHENTICATION_REQUIRED);
355
355
}
356
356
357
+ template <class A >
358
+ A wrap_response (std::optional<HttpResponse> response,
359
+ std::function<A(const std::optional<HttpResponse> &response)> wrapperFn) {
360
+ return wrapperFn (response);
361
+ }
362
+
357
363
struct Client final {
358
364
Client () : error_callback_(NoopErrorCallback), debug_(false ), verify_(true ) {}
359
365
explicit Client (ErrorCallback error_callback) : error_callback_(std::move(error_callback)), debug_(false ), verify_(true ) {}
0 commit comments