'missing_charset for slack-api

I use Guzzle to send messages to the Slack API. It's all working fine except for the warning missing-charset. Here is my Guzzle function:

private function guzzleClient(string $method, string $url, array $parameters = [])
    {
        $client = new Client(['headers' => [
            'Authorization' => "Bearer " . $this->slackOauthToken,
            'Content-Type' => 'application/json; charset=utf-8',
        ]]);
        switch (strtoupper($method)) {
            case "POST":
                $response = $client->post($url, [RequestOptions::JSON => $parameters]);
                break;
            case "GET":
                $response = $client->get($url, ["query" => $parameters]);
                break;
        }

        $json = json_decode($response->getBody()->getContents());
        if((is_object($json)) && ($json->ok == false)) {
            return "Error: " . $json->error . "\n";
        } else {
            return $json;
        }
    }

As far as I can determine, the charset is there and in the headers. But I keep still getting the missing-chaset error - where am I going wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source