MCPcopy Create free account
hub / github.com/dfranx/SHADERed / encode_query_param

Function encode_query_param

libs/misc/httplib.h:1560–1579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1558}
1559
1560inline 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
1581inline std::string encode_url(const std::string &s) {
1582 std::string result;

Callers 1

params_to_query_strFunction · 0.85

Calls 1

strMethod · 0.80

Tested by

no test coverage detected