diff options
Diffstat (limited to 'sip/src/encoding/mod.rs')
-rw-r--r-- | sip/src/encoding/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sip/src/encoding/mod.rs b/sip/src/encoding/mod.rs index 816aa01..3c2f3fd 100644 --- a/sip/src/encoding/mod.rs +++ b/sip/src/encoding/mod.rs @@ -1,5 +1,6 @@ use std::{fmt::Display, str::FromStr}; +use headers::ContentLength; use request::Request; use response::Response; @@ -43,4 +44,10 @@ impl Message { Message::Response(r) => &mut r.body, } } + pub fn content_length(&self) -> Option<Result<ContentLength, anyhow::Error>> { + match self { + Message::Request(r) => r.headers.get::<ContentLength>(), + Message::Response(r) => r.headers.get::<ContentLength>(), + } + } } |