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

Avoid always passing on an empty body even if not given #1471

Merged

Conversation

razziel89
Copy link
Contributor

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 of main 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.

@github-actions github-actions bot added the bug label Aug 23, 2022
Copy link
Contributor

@adehad adehad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff, thanks for the great quality PR !!

@adehad adehad merged commit 009ec9f into pycontribs:main Aug 23, 2022
@razziel89
Copy link
Contributor Author

You're welcome. Thank you for the quick review and merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants