From c937c89517f389853092bd937baf70664c2435a2 Mon Sep 17 00:00:00 2001 From: Simon Popugaev Date: Wed, 6 Sep 2023 14:30:22 +0300 Subject: [PATCH] url encoding --- src/clients/worker.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/clients/worker.rs b/src/clients/worker.rs index 9666249..a6f94b4 100644 --- a/src/clients/worker.rs +++ b/src/clients/worker.rs @@ -271,16 +271,17 @@ impl WorkerClient for WorkerC template_id: RawTemplateId, auth: &CloudAuthentication, ) -> Result<(), GolemError> { - let mut base_url = self.base_url.clone(); - base_url - .set_scheme("wss") + let mut url = self.base_url.clone(); + 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:>}")))?; + 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()