From 8cdafa62a8ad5db1d57154821a0ad015386fd638 Mon Sep 17 00:00:00 2001 From: bojancrevar Date: Wed, 23 Jul 2025 15:15:29 +0200 Subject: [PATCH] Check for null config.data value in http module --- core/engine/src/handler/function/module/http.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/engine/src/handler/function/module/http.rs b/core/engine/src/handler/function/module/http.rs index 7ff49dd8..99f76cf5 100644 --- a/core/engine/src/handler/function/module/http.rs +++ b/core/engine/src/handler/function/module/http.rs @@ -35,7 +35,6 @@ async fn execute_http<'js>( config: Option, ) -> rquickjs::Result> { static HTTP_CLIENT: OnceLock = OnceLock::new(); - let client = HTTP_CLIENT.get_or_init(|| reqwest::Client::new()).clone(); let mut builder = client.request(method, url); if let Some(data) = data { @@ -48,7 +47,9 @@ async fn execute_http<'js>( .query(config.params.as_slice()); if let Some(data) = config.data { - builder = builder.json(&data.0); + if !matches!(data.0, Variable::Null) { + builder = builder.json(&data.0); + } } }