Skip to content

Commit

Permalink
awc: Rename Client::build to Client::builder (actix#1665)
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc authored Sep 11, 2020
1 parent 22089af commit 121075c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 16 deletions.
2 changes: 2 additions & 0 deletions awc/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changes

## Unreleased - 2020-xx-xx
### Changed
* `Client::build` was renamed to `Client::builder`.


## 2.0.0-beta.4 - 2020-09-09
Expand Down
5 changes: 3 additions & 2 deletions awc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ impl Client {
Client::default()
}

/// Build client instance.
pub fn build() -> ClientBuilder {
/// Create `Client` builder.
/// This function is equivalent of `ClientBuilder::new()`.
pub fn builder() -> ClientBuilder {
ClientBuilder::new()
}

Expand Down
4 changes: 2 additions & 2 deletions awc/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ mod tests {

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

#[actix_rt::test]
async fn test_client_header_override() {
let req = Client::build()
let req = Client::builder()
.header(header::CONTENT_TYPE, "111")
.finish()
.get("/")
Expand Down
2 changes: 1 addition & 1 deletion awc/src/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ mod tests {

#[actix_rt::test]
async fn test_header_override() {
let req = Client::build()
let req = Client::builder()
.header(header::CONTENT_TYPE, "111")
.finish()
.ws("/")
Expand Down
8 changes: 4 additions & 4 deletions awc/tests/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async fn test_timeout() {
.timeout(Duration::from_secs(15))
.finish();

let client = awc::Client::build()
let client = awc::Client::builder()
.connector(connector)
.timeout(Duration::from_millis(50))
.finish();
Expand All @@ -141,7 +141,7 @@ async fn test_timeout_override() {
})))
});

let client = awc::Client::build()
let client = awc::Client::builder()
.timeout(Duration::from_millis(50000))
.finish();
let request = client
Expand Down Expand Up @@ -291,7 +291,7 @@ async fn test_connection_wait_queue() {
})
.await;

let client = awc::Client::build()
let client = awc::Client::builder()
.connector(awc::Connector::new().limit(1).finish())
.finish();

Expand Down Expand Up @@ -340,7 +340,7 @@ async fn test_connection_wait_queue_force_close() {
})
.await;

let client = awc::Client::build()
let client = awc::Client::builder()
.connector(awc::Connector::new().limit(1).finish())
.finish();

Expand Down
2 changes: 1 addition & 1 deletion awc/tests/test_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn test_connection_window_size() {
.set_alpn_protos(b"\x02h2\x08http/1.1")
.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())
.initial_window_size(100)
.initial_connection_window_size(100)
Expand Down
2 changes: 1 addition & 1 deletion awc/tests/test_rustls_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async fn _test_connection_reuse_h2() {
.dangerous()
.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())
.finish();

Expand Down
2 changes: 1 addition & 1 deletion awc/tests/test_ssl_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn test_connection_reuse_h2() {
.set_alpn_protos(b"\x02h2\x08http/1.1")
.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())
.finish();

Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ where
}
};

Client::build().connector(connector).finish()
Client::builder().connector(connector).finish()
};

TestServer {
Expand Down
2 changes: 1 addition & 1 deletion test-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions tests/test_httpserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn test_start() {
{
use actix_http::client;

let client = awc::Client::build()
let client = awc::Client::builder()
.connector(
client::Connector::new()
.timeout(Duration::from_millis(100))
Expand Down Expand Up @@ -115,7 +115,7 @@ async fn test_start_ssl() {
.set_alpn_protos(b"\x02h2\x08http/1.1")
.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())
Expand Down

0 comments on commit 121075c

Please sign in to comment.