diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-07-02 22:15:24 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-07-02 22:15:24 -0400 |
commit | 41fe16978ea506127bf43c21e977fd9581d87282 (patch) | |
tree | b5bf1ef7a37404350d45f0b6e8a00c5b32216e08 /src/http/method.rs | |
parent | more info (diff) | |
download | bashttp-41fe16978ea506127bf43c21e977fd9581d87282.tar.gz bashttp-41fe16978ea506127bf43c21e977fd9581d87282.tar.bz2 bashttp-41fe16978ea506127bf43c21e977fd9581d87282.zip |
add methods to routes, allow custom headers and response codes
Diffstat (limited to 'src/http/method.rs')
-rw-r--r-- | src/http/method.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/http/method.rs b/src/http/method.rs index 55cea65..cecafbf 100644 --- a/src/http/method.rs +++ b/src/http/method.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Hash, Eq, PartialEq)] pub enum Method { Get, Head, @@ -26,5 +26,19 @@ impl Method { _ => None } } + + pub fn deserialize(&self) -> &str { + match self { + Method::Get => "GET", + Method::Head => "HEAD", + Method::Post => "POST", + Method::Put => "PUT", + Method::Delete => "DELETE", + Method::Connect => "CONNECT", + Method::Options => "OPTIONS", + Method::Trace => "TRACE", + Method::Patch => "PATCH", + } + } } |