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

body ergonomics v3 (#2468)

This commit is contained in:
Rob Ede
2021-12-04 19:40:47 +00:00
committed by GitHub
parent a2d5c5a058
commit c7c02ef99d
84 changed files with 2134 additions and 1685 deletions

View File

@@ -13,7 +13,7 @@ use actix_http::{
header::{HeaderMap, IntoHeaderValue, EXPECT, HOST},
StatusCode,
},
Error, Payload, RequestHeadType, ResponseHead,
Payload, RequestHeadType, ResponseHead,
};
use actix_utils::future::poll_fn;
use bytes::buf::BufMut;
@@ -22,6 +22,8 @@ use futures_core::{ready, Stream};
use futures_util::SinkExt as _;
use pin_project_lite::pin_project;
use crate::BoxError;
use super::connection::{ConnectionIo, H1Connection};
use super::error::{ConnectError, SendRequestError};
@@ -33,7 +35,7 @@ pub(crate) async fn send_request<Io, B>(
where
Io: ConnectionIo,
B: MessageBody,
B::Error: Into<Error>,
B::Error: Into<BoxError>,
{
// set request host header
if !head.as_ref().headers.contains_key(HOST)
@@ -155,7 +157,7 @@ pub(crate) async fn send_body<Io, B>(
where
Io: ConnectionIo,
B: MessageBody,
B::Error: Into<Error>,
B::Error: Into<BoxError>,
{
actix_rt::pin!(body);
@@ -166,7 +168,7 @@ where
Some(Ok(chunk)) => {
framed.as_mut().write(h1::Message::Chunk(Some(chunk)))?;
}
Some(Err(err)) => return Err(err.into().into()),
Some(Err(err)) => return Err(SendRequestError::Body(err.into())),
None => {
eof = true;
framed.as_mut().write(h1::Message::Chunk(None))?;