1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-19 04:15:38 +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 crate::body::BodySize;
use crate::config::ServiceConfig;
use crate::header::ContentEncoding;
use crate::helpers;
use crate::message::{ConnectionType, RequestHead, ResponseHead};
use crate::message::{ConnectionType, Head, RequestHead, ResponseHead};
use crate::request::Request;
use crate::response::Response;
@@ -41,7 +41,7 @@ impl<T: MessageType> Default for MessageEncoder<T> {
pub(crate) trait MessageType: Sized {
fn status(&self) -> Option<StatusCode>;
fn connection_type(&self) -> Option<ConnectionType>;
// fn connection_type(&self) -> Option<ConnectionType>;
fn headers(&self) -> &HeaderMap;
@@ -168,12 +168,12 @@ impl MessageType for Response<()> {
}
fn chunked(&self) -> bool {
!self.head().no_chunking
self.head().chunked()
}
fn connection_type(&self) -> Option<ConnectionType> {
self.head().ctype
}
//fn connection_type(&self) -> Option<ConnectionType> {
// self.head().ctype
//}
fn headers(&self) -> &HeaderMap {
&self.head().headers
@@ -196,12 +196,8 @@ impl MessageType for RequestHead {
None
}
fn connection_type(&self) -> Option<ConnectionType> {
self.ctype
}
fn chunked(&self) -> bool {
!self.no_chunking
self.chunked()
}
fn headers(&self) -> &HeaderMap {