MCPcopy Create free account
hub / github.com/XTXMarkets/ternfs / encode_query_param

Function encode_query_param

cpp/core/httplib.h:2337–2356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2335}
2336
2337inline std::string encode_query_param(const std::string &value) {
2338 std::ostringstream escaped;
2339 escaped.fill('0');
2340 escaped << std::hex;
2341
2342 for (auto c : value) {
2343 if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' ||
2344 c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' ||
2345 c == ')') {
2346 escaped << c;
2347 } else {
2348 escaped << std::uppercase;
2349 escaped << '%' << std::setw(2)
2350 << static_cast<int>(static_cast<unsigned char>(c));
2351 escaped << std::nouppercase;
2352 }
2353 }
2354
2355 return escaped.str();
2356}
2357
2358inline std::string encode_url(const std::string &s) {
2359 std::string result;

Callers 1

params_to_query_strFunction · 0.85

Calls 1

fillMethod · 0.45

Tested by

no test coverage detected