| 2335 | } |
| 2336 | |
| 2337 | inline std::string encode_query_param(const std::string &value) { |
| 2338 | std::ostringstream escaped; |
| 2339 | escaped.fill('0'); |
| 2340 | escaped << std::hex; |
| 2341 | |
| 2342 | for (auto c : value) { |
| 2343 | if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' || |
| 2344 | c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || |
| 2345 | c == ')') { |
| 2346 | escaped << c; |
| 2347 | } else { |
| 2348 | escaped << std::uppercase; |
| 2349 | escaped << '%' << std::setw(2) |
| 2350 | << static_cast<int>(static_cast<unsigned char>(c)); |
| 2351 | escaped << std::nouppercase; |
| 2352 | } |
| 2353 | } |
| 2354 | |
| 2355 | return escaped.str(); |
| 2356 | } |
| 2357 | |
| 2358 | inline std::string encode_url(const std::string &s) { |
| 2359 | std::string result; |
no test coverage detected