Skip to content

Commit 239113a

Browse files
Bump HTTP API client to 0.83.0
1 parent 4277b23 commit 239113a

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ reqwest = { version = "0.13", default-features = false, features = [
3333
rabbitmq_http_client = { version = "0.83", default-features = false, features = [
3434
"blocking",
3535
"tabled",
36-
"rustls-tls",
36+
"rustls",
3737
] }
3838
serde = { version = "1.0", features = ["derive", "std"] }
3939
serde_json = "1.0"

src/errors.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
use rabbitmq_http_client::blocking_api::EndpointValidationError;
1516
use rabbitmq_http_client::error::{ConversionError, Error as ApiClientError, ErrorDetails};
1617
use rabbitmq_http_client::{blocking_api::HttpClientError, responses::HealthCheckFailureDetails};
1718
use reqwest::StatusCode;
@@ -140,6 +141,22 @@ impl From<HttpClientError> for CommandRunError {
140141
}
141142
}
142143

144+
impl From<EndpointValidationError> for CommandRunError {
145+
fn from(value: EndpointValidationError) -> Self {
146+
match value {
147+
EndpointValidationError::UnsupportedScheme { endpoint } => {
148+
CommandRunError::InvalidBaseUri {
149+
uri: endpoint,
150+
message: "unsupported URI scheme".to_owned(),
151+
}
152+
}
153+
EndpointValidationError::ClientBuildError { source } => {
154+
CommandRunError::HttpClientBuildError(source)
155+
}
156+
}
157+
}
158+
}
159+
143160
fn format_client_error(status_code: &StatusCode, error_details: &Option<ErrorDetails>) -> String {
144161
if let Some(details) = error_details
145162
&& let Some(reason) = details.reason()

src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ use crate::constants::{
4545
TANZU_COMMAND_PREFIX,
4646
};
4747
use crate::output::*;
48-
use rabbitmq_http_client::blocking_api::{Client as GenericAPIClient, ClientBuilder};
48+
use rabbitmq_http_client::blocking_api::{
49+
Client as GenericAPIClient, ClientBuilder, EndpointValidationError,
50+
};
4951
use reqwest::blocking::Client as HTTPClient;
5052
use rustls::crypto::CryptoProvider;
5153
use rustls::pki_types::PrivateKeyDer;
@@ -156,7 +158,7 @@ fn configure_http_api_client<'a>(
156158
username.clone(),
157159
password.clone(),
158160
timeout,
159-
);
161+
)?;
160162
Ok(client)
161163
}
162164

@@ -260,7 +262,7 @@ fn build_rabbitmq_http_api_client(
260262
username: String,
261263
password: String,
262264
timeout: Duration,
263-
) -> APIClient {
265+
) -> Result<APIClient, EndpointValidationError> {
264266
ClientBuilder::new()
265267
.with_endpoint(endpoint)
266268
.with_basic_auth_credentials(username, password)

0 commit comments

Comments
 (0)