From aa06022bfbf3f8d3f0c9614851aefb852da9c638 Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 30 Oct 2024 20:41:35 +0900 Subject: [PATCH] use reqwest for post to Slack --- src/slack.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/slack.rs b/src/slack.rs index e521501..2746812 100644 --- a/src/slack.rs +++ b/src/slack.rs @@ -60,14 +60,12 @@ impl Message { }; // post - let r = surf::post("https://slack.com/api/chat.postMessage") - .header( - surf::http::headers::AUTHORIZATION, - format!("Bearer {}", &token), - ) - .body_json(&payload) - .expect("post json") - .recv_string() + let client = reqwest::Client::new(); + let r = client + .post("https://slack.com/api/chat.postMessage") + .bearer_auth(token) + .json(&payload) + .send() .await; debug!("{:?}", &r);