spotify / web-api

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
983 stars 79 forks source link

UnityWebRequest.Put() not working for Play/Resume EndPoint. Error 400 Malformed JSON #1556

Open dassoop opened 4 years ago

dassoop commented 4 years ago

The UnityWebRequest.Put() works fine for the Pause EndPoint but not the Play/Resume. I am not passing any body data for either of these calls. No context_uri and no uri.

`public void PlayButtonRequest()
    {
        UnityWebRequest www = UnityWebRequest.Put("https://api.spotify.com/v1/me/player/play", "bodyData");
        www.SetRequestHeader("Authorization", "Bearer " + accessToken);
        www.SetRequestHeader("Content-Type", "application/json");
        www.SetRequestHeader("Accept", "application/json");
        StartCoroutine(PlayButtonResponse(www));
    }

    IEnumerator PlayButtonResponse(UnityWebRequest www)
    {
        yield return www.SendWebRequest();

        if (www.isNetworkError)
        {
            Debug.Log(www.error);
        }

        else
        {
            Debug.Log(www.downloadHandler.text);
        }
    }`

Issue found on April 25th 2020.

Endpoint(s):

Scope(s):

Expected behaviour:

Actual behaviour:

400 Malformed JSON