Skip to content

Commit

Permalink
Fix API to work with Unity 2022.1 or older
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Nov 3, 2024
1 parent 2ec2c37 commit 57849d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Runtime/Reporters/Slack/SlackAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ private static async UniTask<SlackResponse> Post(string url, WWWForm form)

private static async UniTask<SlackResponse> 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();

Expand Down

0 comments on commit 57849d4

Please sign in to comment.