| 1558 | } |
| 1559 | |
| 1560 | inline std::string encode_query_param(const std::string &value) { |
| 1561 | std::ostringstream escaped; |
| 1562 | escaped.fill('0'); |
| 1563 | escaped << std::hex; |
| 1564 | |
| 1565 | for (auto c : value) { |
| 1566 | if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' || |
| 1567 | c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || |
| 1568 | c == ')') { |
| 1569 | escaped << c; |
| 1570 | } else { |
| 1571 | escaped << std::uppercase; |
| 1572 | escaped << '%' << std::setw(2) |
| 1573 | << static_cast<int>(static_cast<unsigned char>(c)); |
| 1574 | escaped << std::nouppercase; |
| 1575 | } |
| 1576 | } |
| 1577 | |
| 1578 | return escaped.str(); |
| 1579 | } |
| 1580 | |
| 1581 | inline std::string encode_url(const std::string &s) { |
| 1582 | std::string result; |
no test coverage detected