1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-23 22:15:13 +02:00

refactor RequestHead/ResponseHead

This commit is contained in:
Nikolay Kim
2019-03-27 10:38:01 -07:00
parent fb9c94c3e0
commit 3edc515bac
13 changed files with 191 additions and 132 deletions

View File

@@ -15,7 +15,7 @@ use serde_json;
use crate::body::{Body, BodyStream, MessageBody, ResponseBody};
use crate::error::Error;
use crate::header::{Header, IntoHeaderValue};
use crate::message::{ConnectionType, Head, Message, ResponseHead};
use crate::message::{ConnectionType, Message, ResponseHead};
/// An HTTP Response
pub struct Response<B = Body> {
@@ -462,7 +462,7 @@ impl ResponseBuilder {
#[inline]
pub fn no_chunking(&mut self) -> &mut Self {
if let Some(parts) = parts(&mut self.head, &self.err) {
parts.no_chunking = true;
parts.no_chunking(true);
}
self
}
@@ -740,7 +740,7 @@ impl<'a> From<&'a ResponseHead> for ResponseBuilder {
msg.status = head.status;
msg.reason = head.reason;
msg.headers = head.headers.clone();
msg.no_chunking = head.no_chunking;
msg.no_chunking(!head.chunked());
ResponseBuilder {
head: Some(msg),