diff --git a/backend/src/connector/client.rs b/backend/src/connector/client.rs index eeb5d4d6..6d4891b5 100644 --- a/backend/src/connector/client.rs +++ b/backend/src/connector/client.rs @@ -37,7 +37,7 @@ use axum::{ }; use error_stack::ResultExt; use frunk::hlist::Selector; -use hyper::{service::Service, Body, Request, Response, Uri}; +use hyper::{service::Service, Body, Method, Request, Response, Uri}; use serde::de::DeserializeOwned; use std::{ marker::PhantomData, @@ -255,12 +255,17 @@ where + Sync + 'static, { - fn form_get_request(&self, endpoint: &str, context: &C) -> Result, ClientError> { + fn form_request( + &self, + endpoint: &str, + method: Method, + context: &C, + ) -> Result, ClientError> { let uri = format!("{}{endpoint}", self.base_path); let uri = Uri::from_str(&uri).change_context(ClientError::BadAddress)?; let mut request = Request::builder() - .method("GET") + .method(method) .uri(uri) .body(Body::empty()) .change_context(ClientError::CantFormRequest)?; @@ -350,7 +355,7 @@ where #[must_use] async fn get_nodes(&self, context: &C) -> Result { let request = self - .form_get_request("/nodes", context) + .form_request("/nodes", Method::GET, context) .change_context(APIError::RequestFailed)?; let response = self.call(request, context).await?;