Skip to main content

http_type/response/
struct.rs

1use super::*;
2
3/// Represents a parsed HTTP response.
4///
5/// The fields are crate-internal (ยง17.18): a consumer reaches them through
6/// the generated `get_*` and `set_*` accessors.
7#[derive(Clone, Data, Debug, Deserialize, DisplayDebug, Eq, PartialEq, Serialize)]
8pub struct Response {
9    /// The HTTP version used in the response.
10    pub(crate) version: HttpVersion,
11    /// The HTTP status code.
12    #[get(type(copy))]
13    pub(crate) status_code: usize,
14    /// The reason phrase associated with the status code.
15    #[set(skip)]
16    pub(crate) reason_phrase: String,
17    /// The response headers as key-value pairs.
18    pub(crate) headers: ResponseHeaders,
19    /// The binary body content of the response.
20    #[set(skip)]
21    pub(crate) body: Vec<u8>,
22}