1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 14:49:20 +02:00

add client http/2 support

This commit is contained in:
Nikolay Kim
2019-01-28 20:41:09 -08:00
parent 12fb94204f
commit 4a388d7ad9
15 changed files with 719 additions and 402 deletions

View File

@ -13,8 +13,8 @@ use net2::TcpBuilder;
use actix_http::body::MessageBody;
use actix_http::client::{
ClientRequest, ClientRequestBuilder, ClientResponse, Connect, Connection, Connector,
ConnectorError, SendRequestError,
ClientRequest, ClientRequestBuilder, ClientResponse, Connect, Connector,
ConnectorError, RequestSender, SendRequestError,
};
use actix_http::ws;
@ -57,7 +57,7 @@ impl TestServer {
pub fn with_factory<F: StreamServiceFactory>(
factory: F,
) -> TestServerRuntime<
impl Service<Connect, Response = impl Connection, Error = ConnectorError> + Clone,
impl Service<Connect, Response = impl RequestSender, Error = ConnectorError> + Clone,
> {
let (tx, rx) = mpsc::channel();
@ -89,7 +89,7 @@ impl TestServer {
}
fn new_connector(
) -> impl Service<Connect, Response = impl Connection, Error = ConnectorError> + Clone
) -> impl Service<Connect, Response = impl RequestSender, Error = ConnectorError> + Clone
{
#[cfg(feature = "ssl")]
{
@ -192,7 +192,7 @@ impl<T> TestServerRuntime<T> {
impl<T> TestServerRuntime<T>
where
T: Service<Connect, Error = ConnectorError> + Clone,
T::Response: Connection,
T::Response: RequestSender,
{
/// Connect to websocket server at a given path
pub fn ws_at(
@ -212,7 +212,7 @@ where
}
/// Send request and read response message
pub fn send_request<B: MessageBody>(
pub fn send_request<B: MessageBody + 'static>(
&mut self,
req: ClientRequest<B>,
) -> Result<ClientResponse, SendRequestError> {