pub enum HttpMethod {
Get,
Head,
Post,
Put,
Delete,
Connect,
Options,
Trace,
Patch,
}Expand description
Standard HTTP request methods (RFC 9110 §9).
Variants§
Get
Transfer a current representation of the target resource.
Head
Same as GET, but do not transfer the response body.
Post
Perform resource-specific processing on the request payload.
Put
Replace all current representations of the target resource.
Delete
Remove all current representations of the target resource.
Connect
Establish a tunnel to the server identified by the target resource.
Options
Describe the communication options for the target resource.
Trace
Perform a message loop-back test along the path to the target resource.
Patch
Apply a set of changes to the target resource.
Implementations§
Source§impl HttpMethod
impl HttpMethod
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Return the uppercase string representation of this method.
use api_bones::method::HttpMethod;
assert_eq!(HttpMethod::Delete.as_str(), "DELETE");Sourcepub const fn is_safe(&self) -> bool
pub const fn is_safe(&self) -> bool
Returns true for methods that are safe (read-only, no side effects).
Safe methods per RFC 9110 §9.2.1: GET, HEAD, OPTIONS, TRACE.
use api_bones::method::HttpMethod;
assert!(HttpMethod::Get.is_safe());
assert!(!HttpMethod::Post.is_safe());Sourcepub const fn is_idempotent(&self) -> bool
pub const fn is_idempotent(&self) -> bool
Returns true for methods that are idempotent.
Idempotent methods per RFC 9110 §9.2.2: GET, HEAD, PUT, DELETE, OPTIONS, TRACE.
use api_bones::method::HttpMethod;
assert!(HttpMethod::Put.is_idempotent());
assert!(!HttpMethod::Post.is_idempotent());Trait Implementations§
Source§impl Clone for HttpMethod
impl Clone for HttpMethod
Source§fn clone(&self) -> HttpMethod
fn clone(&self) -> HttpMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more