summaryrefslogtreecommitdiff
path: root/src/http/method.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/method.rs')
-rw-r--r--src/http/method.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/http/method.rs b/src/http/method.rs
new file mode 100644
index 0000000..55cea65
--- /dev/null
+++ b/src/http/method.rs
@@ -0,0 +1,30 @@
+#[derive(Debug, Clone)]
+pub enum Method {
+ Get,
+ Head,
+ Post,
+ Put,
+ Delete,
+ Connect,
+ Options,
+ Trace,
+ Patch
+}
+
+impl Method {
+ pub fn serialize(string: &str) -> Option<Self> {
+ match string {
+ "GET" => Some(Self::Get),
+ "HEAD" => Some(Self::Head),
+ "POST" => Some(Self::Post),
+ "PUT" => Some(Self::Put),
+ "DELETE" => Some(Self::Delete),
+ "CONNECT" => Some(Self::Connect),
+ "OPTIONS" => Some(Self::Options),
+ "TRACE" => Some(Self::Trace),
+ "PATCH" => Some(Self::Patch),
+ _ => None
+ }
+ }
+}
+