DoxigAlpha

idempotent

An HTTP method is idempotent if an identical request can be made once or several times in a row with the same effect while leaving the server in the same state.

https://developer.mozilla.org/en-US/docs/Glossary/Idempotent

https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.2

Function parameters

Parameters

#

Type definitions in this namespace

Types

#
Method
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
Status
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
TransferEncoding
compression is intentionally omitted here since it is handled in `ContentEncoding`.
BodyWriter
Request or response body.

Source

Implementation

#
pub fn idempotent(m: Method) bool {
    return switch (m) {
        .GET, .HEAD, .PUT, .DELETE, .OPTIONS, .TRACE => true,
        .CONNECT, .POST, .PATCH => false,
    };
}