Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
archeoss committed Oct 20, 2023
1 parent cf957e9 commit 83ef49e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions backend/src/connector/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -255,12 +255,17 @@ where
+ Sync
+ 'static,
{
fn form_get_request(&self, endpoint: &str, context: &C) -> Result<Request<Body>, ClientError> {
fn form_request(
&self,
endpoint: &str,
method: Method,
context: &C,
) -> Result<Request<Body>, 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)?;
Expand Down Expand Up @@ -350,7 +355,7 @@ where
#[must_use]
async fn get_nodes(&self, context: &C) -> Result<GetNodesResponse, APIError> {
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?;

Expand Down

0 comments on commit 83ef49e

Please sign in to comment.