Skip to content

Calls to Spotify API can raise exception when the response is not JSON #6776

Description

@Jackenmen

Report by alec in discord. When the status of request to fetch token from spotify isn't 200, The content-type is not json.
Image

While we are still here, the self.get() suffers from the same problem, it tries to parse json despite the response not necessarily being one (mostly when response status is 5xx). Fixing the get req needs lots of other changes and error handling pretty much all over the api interface, because it is used in many places unlike post (which just occurs once).

Originally posted by @npc203 in #5359 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: Cogs - AudioThis is related to the Audio cog.Status: AcceptedWe want thisStatus: PRs WelcomeNo one is currently assigned to this issue, but we'd be grateful if anyone made a PR.Type: BugUnexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions