Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
url encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
senia-psm committed Sep 6, 2023
1 parent 0178d44 commit f79fa96
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/clients/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,15 @@ impl<C: golem_client::instance::Instance + Send + Sync> WorkerClient for WorkerC
}

async fn connect(&self, name: WorkerName, template_id: RawTemplateId, auth: &CloudAuthentication) -> Result<(), GolemError> {
let mut base_url = self.base_url.clone();
base_url.set_scheme("wss").map_err(|_| GolemError("Can't set schema.".to_string()))?;
let url = base_url.join(&format!("/v1/templates/{}/workers/{}/connect", template_id.0, name.0))
.map_err(|e| GolemError(format!("Failed to join url: {e:>}")))?;
let mut url = self.base_url.clone();
url.set_scheme("wss").map_err(|_| GolemError("Can't set schema.".to_string()))?;
url.path_segments_mut().map_err(|_| GolemError("Can't get path.".to_string()))?
.push("v1")
.push("templates")
.push(&template_id.0.to_string())
.push("workers")
.push(&name.0)
.push("connect");

let mut request = url.into_client_request().map_err(|e| GolemError(format!("Can't create request: {e}")))?;
let headers = request.headers_mut();
Expand Down

0 comments on commit f79fa96

Please sign in to comment.