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) {
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;