| 2648 | } |
| 2649 | |
| 2650 | inline std::string encode_query_param(const std::string &value) { |
| 2651 | std::ostringstream escaped; |
| 2652 | escaped.fill('0'); |
| 2653 | escaped << std::hex; |
| 2654 | |
| 2655 | for (auto c : value) { |
| 2656 | if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' || |
| 2657 | c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || |
| 2658 | c == ')') { |
| 2659 | escaped << c; |
| 2660 | } else { |
| 2661 | escaped << std::uppercase; |
| 2662 | escaped << '%' << std::setw(2) |
| 2663 | << static_cast<int>(static_cast<unsigned char>(c)); |
| 2664 | escaped << std::nouppercase; |
| 2665 | } |
| 2666 | } |
| 2667 | |
| 2668 | return escaped.str(); |
| 2669 | } |
| 2670 | |
| 2671 | inline std::string encode_url(const std::string &s) { |
| 2672 | std::string result; |
no test coverage detected