private static function fixRequestUri(string $requestUri): string
    {
        return preg_replace_callback('|[^a-zA-Z0-9-._~:/?[\\]@!$&\'()*+,;=%]|', function (array $matches) {
            return '%' . sprintf('%02X', ord($matches[0]));
        }, $requestUri);
    }