Skip to content

Commit 81d0032

Browse files
authored
fix: include port in API base URL and remove redundant must_use
- Ensures the port number from the profile's api_base_url is preserved when constructing the client base URL, preventing connection issues when using non-standard ports - Removes redundant #[must_use] attribute from PartialEq::eq impl as comparison results are inherently must-use by trait semantics
2 parents 84fa3e3 + 1ba7c51 commit 81d0032

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

base/src/errors/esc_error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ impl From<ApiResponseError> for EscError {
7070
}
7171

7272
impl PartialEq for EscError {
73-
#[must_use]
7473
fn eq(&self, other: &EscError) -> bool {
7574
match self {
7675
EscError::ApiResponse(err) => match other {

cli/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,11 +1988,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
19881988
.get_current_profile()
19891989
.and_then(|profile| {
19901990
profile.api_base_url.as_ref().map(|url| {
1991-
format!(
1991+
let mut parsed_url = format!(
19921992
"{}://{}",
19931993
url.scheme(),
19941994
url.host_str().expect("Pre-validated it has a host")
1995-
)
1995+
);
1996+
if let Some(port) = url.port() {
1997+
parsed_url.push_str(&format!(":{}", port));
1998+
}
1999+
parsed_url
19962000
})
19972001
})
19982002
.unwrap_or_else(|| constants::ES_CLOUD_API_URL.to_string());

0 commit comments

Comments
 (0)