catnap
REST clients generated from annotated Rust traits, in the style of MicroProfile REST Client. Invalid HTTP declarations fail at compile time, and the generated client's behaviour is explicit and easy to extend.
Availability
Use catnap from source as a Git dependency. The crate with the same name on crates.io is an unrelated project. Requires Rust 1.88 or later.
Details
You describe an API as a trait and annotate its methods with paths,
verbs, headers and media types. #[rest_client] leaves the
trait alone and generates a cloneable client that implements it on
top of reqwest, rejecting invalid declarations at compile time.
It covers GET, POST, PUT, PATCH, DELETE, OPTIONS and HEAD; percent-encoded path variables; query parameters in several encodings, including maps; default headers and Basic auth; and JSON by default, with plain text, status-only, raw streaming responses and optional XML. Ordered request and response filters and exception mappers let you hook in, and tracing output redacts authorization and cookie headers.
Base URL, redirects, proxy, timeouts and query style can come from a builder or from MicroProfile-style environment variables.