pub enum HttpMethod {
Show 13 variants
Get,
Post,
Put,
Patch,
Delete,
Head,
Options,
Trace,
Connect,
Other,
All,
Safe,
Unsafe,
}Variants§
Get
Post
Put
Patch
Delete
Head
Options
Trace
Connect
Other
代表非标准的 HTTP 方法。
All
代表所有 HTTP 方法,通常用于管理员权限。
Safe
代表所有安全的 HTTP 方法,你可以参看 HttpMethod::safe 获取 安全 一词的含义
Unsafe
代表所有不安全的 HTTP 方法,你可以参看 HttpMethod::safe 获取 安全 一词的含义
Implementations§
Source§impl HttpMethod
impl HttpMethod
Sourcepub fn safe(self) -> bool
pub fn safe(self) -> bool
§判断一个方法是否安全
一个方法是否安全取决于该方法的请求在被服务器响应后,服务器的状态是否改变
或者说一个方法安不安全取决于是否蕴含着写入请求
所以,对于 OPTIONS 这类在通常认知中
会造成服务器信息暴露等问题的方法,仍然认为是安全的
同时,在这里,由于有两个例外:HttpMethod::Other 和 HttpMethod::All 这两个标记
它们两个一个代表其他请求(rfc规范之外的),一个代表所有的请求,包括 rfc 规范之外的,所以都视为不安全
pub fn as_str(self) -> &'static str
Trait Implementations§
Source§impl Clone for HttpMethod
impl Clone for HttpMethod
Source§fn clone(&self) -> HttpMethod
fn clone(&self) -> HttpMethod
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for HttpMethod
Source§impl Debug for HttpMethod
impl Debug for HttpMethod
Source§impl<'de> Deserialize<'de> for HttpMethod
impl<'de> Deserialize<'de> for HttpMethod
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for HttpMethod
Source§impl From<&Method> for HttpMethod
impl From<&Method> for HttpMethod
Source§impl From<Method> for HttpMethod
impl From<Method> for HttpMethod
Source§impl Hash for HttpMethod
impl Hash for HttpMethod
Source§impl PartialEq for HttpMethod
impl PartialEq for HttpMethod
Source§fn eq(&self, other: &HttpMethod) -> bool
fn eq(&self, other: &HttpMethod) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for HttpMethod
impl Serialize for HttpMethod
impl StructuralPartialEq for HttpMethod
Source§impl ValueEnum for HttpMethod
impl ValueEnum for HttpMethod
Auto Trait Implementations§
impl Freeze for HttpMethod
impl RefUnwindSafe for HttpMethod
impl Send for HttpMethod
impl Sync for HttpMethod
impl Unpin for HttpMethod
impl UnsafeUnpin for HttpMethod
impl UnwindSafe for HttpMethod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more