Minimal application/x-www-form-urlencoded query string lookup, e.g. query_param("model=pocket-tts&foo=bar", "model") -> "pocket-tts".
| 37 | // configured ceiling"; a value is clamped to that ceiling by resolve_busy_timeout_ms |
| 38 | // so a client can shorten its own wait but never weaken the guard. |
| 39 | std::optional<int> parse_busy_timeout_override(const Value & body) { |
| 40 | const auto * value = body.find("busy_timeout_ms"); |
| 41 | if (value == nullptr) { |
| 42 | return std::nullopt; |
| 43 | } |
| 44 | const auto requested = engine::io::json::optional_i32(body, "busy_timeout_ms", 0); |
| 45 | if (requested < 0) { |
| 46 | throw std::runtime_error("busy_timeout_ms must be >= 0 (0 means no client-side bound)"); |
| 47 | } |
| 48 | return requested; |
| 49 | } |
| 50 | |
| 51 | std::string json_quote(std::string_view value) { |
| 52 | return engine::io::json::stringify_string(value); |
| 53 | } |
| 54 | |
| 55 | std::filesystem::path resolve_path(const std::filesystem::path & base, const std::filesystem::path & path) { |
| 56 | return path.is_absolute() ? path : base / path; |
| 57 | } |
| 58 |
no test coverage detected