MarketSquare / MarketSquare/robotframework-requests
Better error message when expecting JSON but get 204 (No content) response
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 512
- Forks
- 283
- PR merge metrics
- No merged PRs in 30d
Description
If we do a GET request that expects a JSON response, like so:
```robot
${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)` 🙂
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the RequestsLibrary.GET keyword and the response.json() handling described in the report, then reproduce the case with a GET request returning HTTP 204. Done means that an empty 204 response produces a friendly, specific error instead of the raw JSONDecodeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100