| 2137 | } |
| 2138 | |
| 2139 | inline std::string encode_query_param(const std::string &value) { |
| 2140 | std::ostringstream escaped; |
| 2141 | escaped.fill('0'); |
| 2142 | escaped << std::hex; |
| 2143 | |
| 2144 | for (auto c : value) { |
| 2145 | if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' || |
| 2146 | c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || |
| 2147 | c == ')') { |
| 2148 | escaped << c; |
| 2149 | } else { |
| 2150 | escaped << std::uppercase; |
| 2151 | escaped << '%' << std::setw(2) |
| 2152 | << static_cast<int>(static_cast<unsigned char>(c)); |
| 2153 | escaped << std::nouppercase; |
| 2154 | } |
| 2155 | } |
| 2156 | |
| 2157 | return escaped.str(); |
| 2158 | } |
| 2159 | |
| 2160 | inline std::string encode_url(const std::string &s) { |
| 2161 | std::string result; |
no test coverage detected