aboutsummaryrefslogtreecommitdiff
path: root/sip/src/encoding/mod.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-02-22 12:25:32 +0100
committermetamuffin <metamuffin@disroot.org>2025-02-22 12:25:32 +0100
commit622ed285b029dfa3b65cc3f13b51c1e0b83262b9 (patch)
treee6b6ba61c1824b16f1ae24059cac1499af5717ac /sip/src/encoding/mod.rs
parent8e19859996eee29ba28c4e4a933ba396924ac163 (diff)
downloadsip-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.rs7
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>(),
+ }
+ }
}