Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Eli-Black-Work opened this issue Dec 21, 2022 · 1 comment

Comments

@Eli-Black-Work
Copy link

Eli-Black-Work commented Dec 21, 2022

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) 🙂

@lucagiove
Copy link
Member

Would be nice having a flask test endpoint to show this issue, but ok I think I understood the point, needs investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants