diff --git a/src/http/routers/v1.rs b/src/http/routers/v1.rs index 4a0e98e37..7e7027573 100644 --- a/src/http/routers/v1.rs +++ b/src/http/routers/v1.rs @@ -9,7 +9,7 @@ use hyper::Body; use hyper::Response; use tower_http::cors::CorsLayer; -use crate::{telemetry_delete, telemetry_get, telemetry_post}; +use crate::{telemetry_get, telemetry_post}; use crate::custom_error::ScratchError; use crate::global_context::SharedGlobalContext; use crate::http::routers::v1::code_completion::{handle_v1_code_completion_web, handle_v1_code_completion_prompt}; @@ -129,7 +129,7 @@ pub fn make_v1_router() -> Router { .route("/integrations-filtered/:integr_name", get(handle_v1_integrations_filtered)) .route("/integration-get", telemetry_post!(handle_v1_integration_get)) .route("/integration-save", telemetry_post!(handle_v1_integration_save)) - .route("/integration-delete", telemetry_delete!(handle_v1_integration_delete)) + .route("/integration-delete", delete(handle_v1_integration_delete)) .route("/integration-icon/:icon_name", get(handle_v1_integration_icon)) .route("/docker-container-list", telemetry_post!(handle_v1_docker_container_list)) diff --git a/src/http/routers/v1/v1_integrations.rs b/src/http/routers/v1/v1_integrations.rs index dbf0ec365..14863f172 100644 --- a/src/http/routers/v1/v1_integrations.rs +++ b/src/http/routers/v1/v1_integrations.rs @@ -7,6 +7,7 @@ use serde::Deserialize; use tokio::sync::RwLock as ARwLock; use regex::Regex; use axum::extract::Path; +use axum::extract::Query; use crate::custom_error::ScratchError; @@ -159,12 +160,9 @@ pub struct HTTPIntegrationDeleteQueryParams { } pub async fn handle_v1_integration_delete( - Extension(_gcx): Extension>>, - body_bytes: hyper::body::Bytes, + Query(params): Query, ) -> axum::response::Result, ScratchError> { - let data = serde_json::from_slice::(&body_bytes) - .map_err(|e| ScratchError::new(StatusCode::UNPROCESSABLE_ENTITY, format!("JSON problem: {}", e)))?; - let integration_path = data.integration_path; + let integration_path = params.integration_path; log::info!("Deleting integration path: {:?}", integration_path); split_path_into_project_and_integration(&integration_path).map_err( diff --git a/src/http/utils.rs b/src/http/utils.rs index 38ccde83b..2b17aead9 100644 --- a/src/http/utils.rs +++ b/src/http/utils.rs @@ -73,19 +73,3 @@ macro_rules! telemetry_get { }) }; } - -#[macro_export] -macro_rules! telemetry_delete { - ( - $name:ident - ) => { - delete(|path, method, ex, body_bytes| async { - let tmp = |ex: Extension, body_bytes: hyper::body::Bytes| - -> Pin, ScratchError>> + Send>> { - Box::pin($name(ex, body_bytes)) - }; - telemetry_wrapper(tmp, path, method, ex, body_bytes).await - }) - }; -} -