expression
Safe and idempotent methods: different guarantees
Safe methods are intended to be read-only. Idempotence describes the intended effect of repeating a request, not identical response bytes or absence of all side effects. Retry decisions also require a replayable body and application policy. External crate example; constructs data in memory, does not send requests. Expected stdout (not executed): GET true true PUT false true POST false false DELETE false true Common mistake: Retrying every POST automatically or treating DELETE as read-only.
Formal Syntax & Structure
rust syntaxrust
method.is_safe(); method.is_idempotent()Working Example
Example Snippetrust
fn main() { use http::Method; for method in [Method::GET, Method::PUT, Method::POST, Method::DELETE] { println!("{} {} {}", method, method.is_safe(), method.is_idempotent()); }}