1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

awc: Rename Client::build to Client::builder (#1665)

This commit is contained in:
Igor Aleksanov 2020-09-11 11:24:39 +03:00 committed by GitHub
parent 22089aff87
commit 121075c1ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,8 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2020-xx-xx
### Changed
* `Client::build` was renamed to `Client::builder`.
## 2.0.0-beta.4 - 2020-09-09 ## 2.0.0-beta.4 - 2020-09-09

View File

@ -166,8 +166,9 @@ impl Client {
Client::default() Client::default()
} }
/// Build client instance. /// Create `Client` builder.
pub fn build() -> ClientBuilder { /// This function is equivalent of `ClientBuilder::new()`.
pub fn builder() -> ClientBuilder {
ClientBuilder::new() ClientBuilder::new()
} }

View File

@ -623,7 +623,7 @@ mod tests {
#[actix_rt::test] #[actix_rt::test]
async fn test_client_header() { async fn test_client_header() {
let req = Client::build() let req = Client::builder()
.header(header::CONTENT_TYPE, "111") .header(header::CONTENT_TYPE, "111")
.finish() .finish()
.get("/"); .get("/");
@ -641,7 +641,7 @@ mod tests {
#[actix_rt::test] #[actix_rt::test]
async fn test_client_header_override() { async fn test_client_header_override() {
let req = Client::build() let req = Client::builder()
.header(header::CONTENT_TYPE, "111") .header(header::CONTENT_TYPE, "111")
.finish() .finish()
.get("/") .get("/")

View File

@ -434,7 +434,7 @@ mod tests {
#[actix_rt::test] #[actix_rt::test]
async fn test_header_override() { async fn test_header_override() {
let req = Client::build() let req = Client::builder()
.header(header::CONTENT_TYPE, "111") .header(header::CONTENT_TYPE, "111")
.finish() .finish()
.ws("/") .ws("/")

View File

@ -120,7 +120,7 @@ async fn test_timeout() {
.timeout(Duration::from_secs(15)) .timeout(Duration::from_secs(15))
.finish(); .finish();
let client = awc::Client::build() let client = awc::Client::builder()
.connector(connector) .connector(connector)
.timeout(Duration::from_millis(50)) .timeout(Duration::from_millis(50))
.finish(); .finish();
@ -141,7 +141,7 @@ async fn test_timeout_override() {
}))) })))
}); });
let client = awc::Client::build() let client = awc::Client::builder()
.timeout(Duration::from_millis(50000)) .timeout(Duration::from_millis(50000))
.finish(); .finish();
let request = client let request = client
@ -291,7 +291,7 @@ async fn test_connection_wait_queue() {
}) })
.await; .await;
let client = awc::Client::build() let client = awc::Client::builder()
.connector(awc::Connector::new().limit(1).finish()) .connector(awc::Connector::new().limit(1).finish())
.finish(); .finish();
@ -340,7 +340,7 @@ async fn test_connection_wait_queue_force_close() {
}) })
.await; .await;
let client = awc::Client::build() let client = awc::Client::builder()
.connector(awc::Connector::new().limit(1).finish()) .connector(awc::Connector::new().limit(1).finish())
.finish(); .finish();

View File

@ -47,7 +47,7 @@ async fn test_connection_window_size() {
.set_alpn_protos(b"\x02h2\x08http/1.1") .set_alpn_protos(b"\x02h2\x08http/1.1")
.map_err(|e| log::error!("Can not set alpn protocol: {:?}", e)); .map_err(|e| log::error!("Can not set alpn protocol: {:?}", e));
let client = awc::Client::build() let client = awc::Client::builder()
.connector(awc::Connector::new().ssl(builder.build()).finish()) .connector(awc::Connector::new().ssl(builder.build()).finish())
.initial_window_size(100) .initial_window_size(100)
.initial_connection_window_size(100) .initial_connection_window_size(100)

View File

@ -82,7 +82,7 @@ async fn _test_connection_reuse_h2() {
.dangerous() .dangerous()
.set_certificate_verifier(Arc::new(danger::NoCertificateVerification {})); .set_certificate_verifier(Arc::new(danger::NoCertificateVerification {}));
let client = awc::Client::build() let client = awc::Client::builder()
.connector(awc::Connector::new().rustls(Arc::new(config)).finish()) .connector(awc::Connector::new().rustls(Arc::new(config)).finish())
.finish(); .finish();

View File

@ -62,7 +62,7 @@ async fn test_connection_reuse_h2() {
.set_alpn_protos(b"\x02h2\x08http/1.1") .set_alpn_protos(b"\x02h2\x08http/1.1")
.map_err(|e| log::error!("Can not set alpn protocol: {:?}", e)); .map_err(|e| log::error!("Can not set alpn protocol: {:?}", e));
let client = awc::Client::build() let client = awc::Client::builder()
.connector(awc::Connector::new().ssl(builder.build()).finish()) .connector(awc::Connector::new().ssl(builder.build()).finish())
.finish(); .finish();

View File

@ -822,7 +822,7 @@ where
} }
}; };
Client::build().connector(connector).finish() Client::builder().connector(connector).finish()
}; };
TestServer { TestServer {

View File

@ -90,7 +90,7 @@ pub async fn test_server<F: ServiceFactory<TcpStream>>(factory: F) -> TestServer
} }
}; };
Client::build().connector(connector).finish() Client::builder().connector(connector).finish()
}; };
actix_connect::start_default_resolver().await.unwrap(); actix_connect::start_default_resolver().await.unwrap();

View File

@ -43,7 +43,7 @@ async fn test_start() {
{ {
use actix_http::client; use actix_http::client;
let client = awc::Client::build() let client = awc::Client::builder()
.connector( .connector(
client::Connector::new() client::Connector::new()
.timeout(Duration::from_millis(100)) .timeout(Duration::from_millis(100))
@ -115,7 +115,7 @@ async fn test_start_ssl() {
.set_alpn_protos(b"\x02h2\x08http/1.1") .set_alpn_protos(b"\x02h2\x08http/1.1")
.map_err(|e| log::error!("Can not set alpn protocol: {:?}", e)); .map_err(|e| log::error!("Can not set alpn protocol: {:?}", e));
let client = awc::Client::build() let client = awc::Client::builder()
.connector( .connector(
awc::Connector::new() awc::Connector::new()
.ssl(builder.build()) .ssl(builder.build())