MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / encode_query_param

Function encode_query_param

examples/server/httplib.h:2139–2158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2137}
2138
2139inline std::string encode_query_param(const std::string &value) {
2140 std::ostringstream escaped;
2141 escaped.fill('0');
2142 escaped << std::hex;
2143
2144 for (auto c : value) {
2145 if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' ||
2146 c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' ||
2147 c == ')') {
2148 escaped << c;
2149 } else {
2150 escaped << std::uppercase;
2151 escaped << '%' << std::setw(2)
2152 << static_cast<int>(static_cast<unsigned char>(c));
2153 escaped << std::nouppercase;
2154 }
2155 }
2156
2157 return escaped.str();
2158}
2159
2160inline std::string encode_url(const std::string &s) {
2161 std::string result;

Callers 1

params_to_query_strFunction · 0.85

Calls 2

fillMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected