diff --git a/src/server/response.rs b/src/server/response.rs index 7ac8103290..ab3dc81e00 100644 --- a/src/server/response.rs +++ b/src/server/response.rs @@ -44,6 +44,19 @@ impl Response { /// 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, + status: status::StatusCode, + headers: header::Headers) -> Response { + Response { + status: status, + version: version, + body: body, + headers: headers + } + } } impl Response { @@ -89,6 +102,11 @@ impl Response { /// 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, status::StatusCode, header::Headers) { + (self.version, self.body, self.status, self.headers) + } } impl Response {