1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 16:55:08 +02:00

rename HttpResponse

This commit is contained in:
Nikolay Kim
2018-10-05 11:04:59 -07:00
parent d53f3d7187
commit 8c2244dd88
16 changed files with 266 additions and 287 deletions

View File

@ -12,8 +12,8 @@ use error::ParseError;
use helpers;
use http::header::{HeaderValue, CONNECTION, CONTENT_LENGTH, DATE, TRANSFER_ENCODING};
use http::{Method, Version};
use httpresponse::HttpResponse;
use request::RequestPool;
use response::Response;
bitflags! {
struct Flags: u8 {
@ -29,7 +29,7 @@ const AVERAGE_HEADER_SIZE: usize = 30;
/// Http response
pub enum OutMessage {
/// Http response message
Response(HttpResponse),
Response(Response),
/// Payload chunk
Payload(Bytes),
}
@ -87,7 +87,7 @@ impl Codec {
}
fn encode_response(
&mut self, mut msg: HttpResponse, buffer: &mut BytesMut,
&mut self, mut msg: Response, buffer: &mut BytesMut,
) -> io::Result<()> {
// prepare transfer encoding
self.te

View File

@ -628,7 +628,7 @@ mod tests {
// let buf = Buffer::new("GET /test HTTP/1\r\n\r\n");
// let readbuf = BytesMut::new();
// let mut h1 = Dispatcher::new(buf, |req| ok(HttpResponse::Ok().finish()));
// let mut h1 = Dispatcher::new(buf, |req| ok(Response::Ok().finish()));
// assert!(h1.poll_io().is_ok());
// assert!(h1.poll_io().is_ok());
// assert!(h1.flags.contains(Flags::READ_DISCONNECTED));

View File

@ -17,8 +17,8 @@ use body::Body;
use config::ServiceConfig;
use error::DispatchError;
use framed::Framed;
use httpresponse::HttpResponse;
use request::Request;
use response::Response;
use super::codec::{Codec, InMessage, OutMessage};
@ -77,7 +77,7 @@ impl<S: Service> State<S> {
impl<T, S> Dispatcher<T, S>
where
T: AsyncRead + AsyncWrite,
S: Service<Request = Request, Response = HttpResponse>,
S: Service<Request = Request, Response = Response>,
S::Error: Debug + Display,
{
/// Create http/1 dispatcher.
@ -415,7 +415,7 @@ where
.insert(Flags::STARTED | Flags::READ_DISCONNECTED);
self.state =
State::SendResponse(Some(OutMessage::Response(
HttpResponse::RequestTimeout().finish(),
Response::RequestTimeout().finish(),
)));
} else {
trace!("Keep-alive timeout, close connection");
@ -452,7 +452,7 @@ where
impl<T, S> Future for Dispatcher<T, S>
where
T: AsyncRead + AsyncWrite,
S: Service<Request = Request, Response = HttpResponse>,
S: Service<Request = Request, Response = Response>,
S::Error: Debug + Display,
{
type Item = ();

View File

@ -11,8 +11,8 @@ use http::{StatusCode, Version};
use body::{Binary, Body};
use header::ContentEncoding;
use http::Method;
use httpresponse::HttpResponse;
use request::Request;
use response::Response;
#[derive(Debug)]
pub(crate) enum ResponseLength {
@ -41,7 +41,7 @@ impl Default for ResponseEncoder {
}
impl ResponseEncoder {
pub fn update(&mut self, resp: &mut HttpResponse, head: bool, version: Version) {
pub fn update(&mut self, resp: &mut Response, head: bool, version: Version) {
self.head = head;
let version = resp.version().unwrap_or_else(|| version);
@ -98,7 +98,7 @@ impl ResponseEncoder {
}
fn streaming_encoding(
&mut self, version: Version, resp: &mut HttpResponse,
&mut self, version: Version, resp: &mut Response,
) -> TransferEncoding {
match resp.chunked() {
Some(true) => {

View File

@ -7,8 +7,8 @@ use tokio_io::{AsyncRead, AsyncWrite};
use config::ServiceConfig;
use error::DispatchError;
use httpresponse::HttpResponse;
use request::Request;
use response::Response;
use super::dispatcher::Dispatcher;
@ -36,7 +36,7 @@ where
impl<T, S> NewService for H1Service<T, S>
where
T: AsyncRead + AsyncWrite,
S: NewService<Request = Request, Response = HttpResponse> + Clone,
S: NewService<Request = Request, Response = Response> + Clone,
S::Service: Clone,
S::Error: Debug + Display,
{
@ -65,7 +65,7 @@ pub struct H1ServiceResponse<T, S: NewService> {
impl<T, S> Future for H1ServiceResponse<T, S>
where
T: AsyncRead + AsyncWrite,
S: NewService<Request = Request, Response = HttpResponse>,
S: NewService<Request = Request, Response = Response>,
S::Service: Clone,
S::Error: Debug + Display,
{
@ -90,7 +90,7 @@ pub struct H1ServiceHandler<T, S> {
impl<T, S> H1ServiceHandler<T, S>
where
S: Service<Request = Request, Response = HttpResponse> + Clone,
S: Service<Request = Request, Response = Response> + Clone,
S::Error: Debug + Display,
{
fn new(cfg: ServiceConfig, srv: S) -> H1ServiceHandler<T, S> {
@ -105,7 +105,7 @@ where
impl<T, S> Service for H1ServiceHandler<T, S>
where
T: AsyncRead + AsyncWrite,
S: Service<Request = Request, Response = HttpResponse> + Clone,
S: Service<Request = Request, Response = Response> + Clone,
S::Error: Debug + Display,
{
type Request = T;