aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/request.rs
blob: 03b93c9eed3505afe69fb26b78d4f498744bde0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use super::{headermap::HeaderMap, method::Method, uri::Uri};
use std::fmt::Display;

pub struct Request {
    pub method: Method,
    pub uri: Uri,
    pub headers: HeaderMap,
}

impl Display for Request {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let Self {
            headers,
            method,
            uri,
        } = self;
        write!(f, "{method} {uri} SIP/2.0\r\n")?;
        write!(f, "{headers}\r\n")?;
        Ok(())
    }
}