| 371 | } |
| 372 | |
| 373 | static std::string build_query_string(const httplib::Request & req) { |
| 374 | std::string qs; |
| 375 | for (const auto & [key, value] : req.params) { |
| 376 | if (!qs.empty()) { |
| 377 | qs += '&'; |
| 378 | } |
| 379 | qs += httplib::encode_query_component(key) + "=" + httplib::encode_query_component(value); |
| 380 | } |
| 381 | return qs; |
| 382 | } |
| 383 | |
| 384 | // using unique_ptr for request to allow safe capturing in lambdas |
| 385 | using server_http_req_ptr = std::unique_ptr<server_http_req>; |