From eb6557a6beb5d3b2324b30f2abc117b1a122c3f7 Mon Sep 17 00:00:00 2001 From: HugoCasa Date: Mon, 29 Jul 2024 15:56:25 +0200 Subject: [PATCH] feat: add support for text/plain webhook (#4146) --- backend/windmill-queue/src/jobs.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 526cae2315b38..d743276cdb7d0 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -2862,6 +2862,14 @@ where Error::BadRequest(format!("Cloud events batching is not supported yet")) .into_response(), ) + } else if content_type.unwrap().starts_with("text/plain") { + let bytes = Bytes::from_request(req, _state) + .await + .map_err(IntoResponse::into_response)?; + let str = String::from_utf8(bytes.to_vec()) + .map_err(|e| Error::BadRequest(format!("invalid utf8: {}", e)).into_response())?; + extra.insert("raw_string".to_string(), to_raw_value(&str)); + Ok(PushArgsOwned { extra: Some(extra), args: HashMap::new() }) } else if content_type .unwrap() .starts_with("application/x-www-form-urlencoded")