| 2030 | } |
| 2031 | |
| 2032 | inline std::string encode_query_param(const std::string& value) { |
| 2033 | std::ostringstream escaped; |
| 2034 | escaped.fill('0'); |
| 2035 | escaped << std::hex; |
| 2036 | |
| 2037 | for (auto c : value) { |
| 2038 | if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' || |
| 2039 | c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || |
| 2040 | c == ')') { |
| 2041 | escaped << c; |
| 2042 | } |
| 2043 | else { |
| 2044 | escaped << std::uppercase; |
| 2045 | escaped << '%' << std::setw(2) |
| 2046 | << static_cast<int>(static_cast<unsigned char>(c)); |
| 2047 | escaped << std::nouppercase; |
| 2048 | } |
| 2049 | } |
| 2050 | |
| 2051 | return escaped.str(); |
| 2052 | } |
| 2053 | |
| 2054 | inline std::string encode_url(const std::string& s) { |
| 2055 | std::string result; |
no outgoing calls
no test coverage detected