Skip to content

Commit

Permalink
Update rs/src/management/http_client.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Connor Peet <[email protected]>
  • Loading branch information
jfullerton44 and connor4312 authored Oct 12, 2023
1 parent fa6a4f7 commit b214852
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rs/src/management/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ impl TunnelManagementClient {
mut tunnel: Tunnel,
options: &TunnelRequestOptions,
) -> HttpResult<Tunnel> {
if tunnel.tunnel_id.is_none() || tunnel.tunnel_id.as_ref().unwrap().is_empty() {
tunnel.tunnel_id = Some(TunnelManagementClient::generate_tunnel_id());
}
let mut url = self.build_uri(tunnel.cluster_id.as_deref(), TUNNELS_API_PATH);
let new_path = url.path().to_owned() + "/" + tunnel.tunnel_id.as_ref().unwrap();
let tunnel_id = match tunnel.tunnel_id.as_ref() {
None | Some("") => TunnelManagementClient::generate_tunnel_id(),
Some(tunnel_id) => tunnel_id.to_owned(),
};
let new_path = url.path().to_owned() + "/" + tunnel_id;
url.set_path(&new_path);
let mut request = self.make_tunnel_request(Method::PUT, url, options).await?;
json_body(&mut request, tunnel);
Expand Down

0 comments on commit b214852

Please sign in to comment.