http_type/response/struct.rs
1use super::*;
2
3/// Represents a parsed HTTP response.
4///
5/// The fields stay `pub`: `type/tests/response` reads them directly, so this is
6/// published API and ยง17.14 does not recall it (semver).
7#[derive(Clone, Data, Debug, Deserialize, DisplayDebug, Eq, PartialEq, Serialize)]
8pub struct Response {
9 /// The HTTP version used in the response.
10 pub version: ResponseVersion,
11 /// The HTTP status code.
12 #[get(type(copy))]
13 pub status_code: ResponseStatusCode,
14 /// The reason phrase associated with the status code.
15 #[set(type(AsRef<str>))]
16 pub reason_phrase: ResponseReasonPhrase,
17 /// The response headers as key-value pairs.
18 pub headers: ResponseHeaders,
19 /// The binary body content of the response.
20 #[set(type(AsRef<[u8]>))]
21 pub body: ResponseBody,
22}