MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / encode_query_param

Function encode_query_param

external/httplib.h:2650–2669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2648}
2649
2650inline std::string encode_query_param(const std::string &value) {
2651 std::ostringstream escaped;
2652 escaped.fill('0');
2653 escaped << std::hex;
2654
2655 for (auto c : value) {
2656 if (std::isalnum(static_cast<uint8_t>(c)) || c == '-' || c == '_' ||
2657 c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' ||
2658 c == ')') {
2659 escaped << c;
2660 } else {
2661 escaped << std::uppercase;
2662 escaped << '%' << std::setw(2)
2663 << static_cast<int>(static_cast<unsigned char>(c));
2664 escaped << std::nouppercase;
2665 }
2666 }
2667
2668 return escaped.str();
2669}
2670
2671inline std::string encode_url(const std::string &s) {
2672 std::string result;

Callers 1

params_to_query_strFunction · 0.85

Calls 1

fillMethod · 0.45

Tested by

no test coverage detected