Avoid always passing on an empty body even if not given #1471
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR suggest a small change to the
ResilientSession
class that avoids sending a request body in cases where none was specified.I have checked issues and PRs in the repository but could not find one that relates to this change.
Motivation
Not all requests contain request bodies. For GET requests, for example, a request body can simply be ignored (please also see this comprehensive answer on StackOverflow). However, there are instances of Jira that fail a GET request if it has a non-empty request body.
Up until the current
main
, all requests have a body (please also see here). Those that do not specify one will have an empty JSON object"{}"
as body. As far as I could determine, this change was introduced in commit c6d59a1.Tests
I have run all the tests for the
ResilientSession
class and they passed. I've also added tests for the new behaviour. I could not get the full test suite running, neither for the current state ofmain
nor for the feature branch.I would be very thankful if you could consider incorporating this pull request. In case you have any questions or would like some changes, I am happy to answer or incorporate them.