separate out response

This commit is contained in:
Martin Algesten
2018-06-30 13:36:41 +02:00
parent f5a4c83819
commit b54f747d16
8 changed files with 111 additions and 19 deletions

View File

@@ -153,7 +153,7 @@ impl Unit {
.map_err(|_| Error::BadUrl(format!("Bad redirection: {}", location)))?;
// perform the redirect differently depending on 3xx code.
return match resp.status {
return match resp.status() {
301 | 302 | 303 => {
send_body(body, self.is_chunked, &mut stream)?;
let empty = Payload::Empty.into_read();
@@ -168,7 +168,7 @@ impl Unit {
send_body(body, self.is_chunked, &mut stream)?;
// since it is not a redirect, give away the incoming stream to the response object
resp.set_stream(stream, self.is_head);
response::set_stream(&mut resp, stream, self.is_head);
// release the response
Ok(resp)