aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/response.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/response.rs')
-rw-r--r--src/encoding/response.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/encoding/response.rs b/src/encoding/response.rs
index ffd2878..0b7996c 100644
--- a/src/encoding/response.rs
+++ b/src/encoding/response.rs
@@ -6,6 +6,7 @@ use std::{fmt::Display, str::FromStr};
pub struct Response {
pub status: Status,
pub headers: HeaderMap,
+ pub body: String,
}
impl FromStr for Response {
@@ -31,14 +32,22 @@ impl FromStr for Response {
let headers = HeaderMap::parse(&mut lines)?;
let status = Status::from_code(code);
- Ok(Self { status, headers })
+ Ok(Self {
+ status,
+ headers,
+ body: String::new(),
+ })
}
}
impl Display for Response {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- let Self { status, headers } = self;
+ let Self {
+ status,
+ headers,
+ body,
+ } = self;
write!(f, "SIP/2.0 {} {status:?}\r\n", status.to_code())?;
- write!(f, "{headers}\r\n")?;
+ write!(f, "{headers}\r\n{body}")?;
Ok(())
}
}