Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/server/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ impl<W: WriteStatus> Response<W> {

/// The headers of this response.
pub fn headers(&self) -> &header::Headers { &self.headers }

/// Construct a Response from its constituent parts.
pub fn construct(version: version::HttpVersion,
body: BufferedWriter<TcpStream>,
status: status::StatusCode,
headers: header::Headers) -> Response<Fresh> {
Response {
status: status,
version: version,
body: body,
headers: headers
}
}
}

impl Response<Fresh> {
Expand Down Expand Up @@ -89,6 +102,11 @@ impl Response<Fresh> {

/// Get a mutable reference to the Headers.
pub fn headers_mut(&mut self) -> &mut header::Headers { &mut self.headers }

/// Deconstruct this Response into its constituent parts.
pub fn deconstruct(self) -> (version::HttpVersion, BufferedWriter<TcpStream>, status::StatusCode, header::Headers) {
(self.version, self.body, self.status, self.headers)
}
}

impl Response<Streaming> {
Expand Down