aboutsummaryrefslogtreecommitdiff
path: root/src/request.rs
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2024-06-05 20:55:59 +0300
committeromagdy7 <omar.professional8777@gmail.com>2024-06-05 20:55:59 +0300
commit4e0078e7bac5a8b3e7e267a1562590d1300dac64 (patch)
tree0bb76af345d44c4ca2fae9be19f8cda897b886a8 /src/request.rs
parent07c54da628ec776627e68c25196539389c8d965c (diff)
downloadtiny-server-4e0078e7bac5a8b3e7e267a1562590d1300dac64.tar.xz
tiny-server-4e0078e7bac5a8b3e7e267a1562590d1300dac64.zip
feat: Added basic handling of Content-Encoding header
Diffstat (limited to 'src/request.rs')
-rw-r--r--src/request.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/request.rs b/src/request.rs
index aed69e5..7c8f43c 100644
--- a/src/request.rs
+++ b/src/request.rs
@@ -24,8 +24,8 @@ impl Request {
}
}
- pub fn get_tag(&self, key: String) -> String {
- self.headers.as_ref().unwrap().0.get(&key).unwrap().clone()
+ pub fn get_tag(&self, key: &str) -> Option<&String> {
+ self.headers.as_ref().unwrap().0.get(&key.to_string())
}
pub fn method(&self) -> &Method {
@@ -48,7 +48,6 @@ impl From<Vec<&str>> for Request {
let (method, headers, body) =
(Method::from(*request_line), Headers::from(headers), body);
if let Some(content_length) = headers.0.get("Content-Length") {
- println!("Well hello there");
let content_length = content_length
.parse::<usize>()
.expect("Content-Length should be parsable to usize");