Skip to content

Better error message when expecting JSON but get 204 (No content) response #371

@Eli-Black-Work

Description

@Eli-Black-Work

If we do a GET request that expects a JSON response, like so:

${response}=  RequestsLibrary.GET  ${url}

then if the server returns 204 (no content) instead of returning JSON, we get this error:

Replacing variables from keyword return value failed: Resolving variable '${response.json()}' failed: JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I think it'd be nice to have a friendly error message for this. Perhaps something like Expected the response to contain JSON, but the response was 204 (No Content) 🙂

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions