1 #ifndef XXHR_PARAMETERS_H 2 #define XXHR_PARAMETERS_H 4 #include <initializer_list> 10 #include "defines.hpp" 15 template <
typename KeyType,
typename ValueType>
16 Parameter(KeyType&& key, ValueType&& value)
17 : key{XXHR_FWD(key)}, value{XXHR_FWD(value)} {}
32 Parameters(
const std::initializer_list<Parameter>& parameters) {
33 for (
const auto& parameter : parameters) {
34 this->insert(parameter);
39 void insert(
const Parameter& parameter) {
40 if (!content.empty()) {
44 auto escapedKey = xxhr::util::urlEncode(parameter.key);
45 if (parameter.value.empty()) {
46 content += escapedKey;
48 auto escapedValue = xxhr::util::urlEncode(parameter.value);
49 content += escapedKey +
"=" + escapedValue;
main library namespace
Definition: api.hpp:19
void insert(const Parameter ¶meter)
adds another parameter
Definition: parameters.hpp:39
Allows passing an initializer list of named HTTP Parameters that will be URL Encoded within the reque...
Definition: parameters.hpp:29