diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-22 12:25:32 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-22 12:25:32 +0100 |
commit | 622ed285b029dfa3b65cc3f13b51c1e0b83262b9 (patch) | |
tree | e6b6ba61c1824b16f1ae24059cac1499af5717ac /sip/src/encoding/mod.rs | |
parent | 8e19859996eee29ba28c4e4a933ba396924ac163 (diff) | |
download | sip-rs-622ed285b029dfa3b65cc3f13b51c1e0b83262b9.tar sip-rs-622ed285b029dfa3b65cc3f13b51c1e0b83262b9.tar.bz2 sip-rs-622ed285b029dfa3b65cc3f13b51c1e0b83262b9.tar.zst |
fix things
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>(), + } + } } |