MCPcopy Create free account
hub / github.com/chrxh/alien / encode_query_param

Function encode_query_param

external/cpp-httplib/httplib.h:2032–2052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers 1

params_to_query_strFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected