From 57849d43f6a9856aa1d6aeaabe5fcd4101209517 Mon Sep 17 00:00:00 2001 From: Koji Hasegawa Date: Mon, 4 Nov 2024 06:50:38 +0900 Subject: [PATCH] Fix API to work with Unity 2022.1 or older --- Runtime/Reporters/Slack/SlackAPI.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Runtime/Reporters/Slack/SlackAPI.cs b/Runtime/Reporters/Slack/SlackAPI.cs index 8407c4e..c2be8a2 100644 --- a/Runtime/Reporters/Slack/SlackAPI.cs +++ b/Runtime/Reporters/Slack/SlackAPI.cs @@ -166,8 +166,14 @@ private static async UniTask Post(string url, WWWForm form) private static async UniTask Post(string url, string token, Payload payload) { +#if UNITY_2022_2_OR_NEWER using (var www = UnityWebRequest.Post(url, payload.ToJson(), "application/json; charset=utf-8")) { +#else + using (var www = UnityWebRequest.Post(url, payload.ToJson())) + { + www.SetRequestHeader("Content-Type", "application/json; charset=utf-8"); +#endif www.SetRequestHeader("Authorization", $"Bearer {token}"); await www.SendWebRequest();