Skip to content

Return body None when request has no body#87

Merged
camilamaia merged 3 commits intomasterfrom
request/no-body
Jan 2, 2020
Merged

Return body None when request has no body#87
camilamaia merged 3 commits intomasterfrom
request/no-body

Conversation

@camilamaia
Copy link
Copy Markdown
Member

Description

When creating requests without body It was setting body as {} instead of None. The consequence of that is that it sends content-length as 2 in the headers, when it should not send content-length at all

@camilamaia camilamaia added the Bug Something isn't working label Dec 20, 2019
@camilamaia camilamaia self-assigned this Dec 20, 2019
Copy link
Copy Markdown
Member

@barbosa barbosa left a comment

Choose a reason for hiding this comment

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

Cool. I wonder if params and headers should have the same behavior for consistency.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 26, 2019

Codecov Report

Merging #87 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #87     +/-   ##
=========================================
+ Coverage   90.08%   90.18%   +0.1%     
=========================================
  Files          14       14             
  Lines         373      377      +4     
=========================================
+ Hits          336      340      +4     
  Misses         37       37
Impacted Files Coverage Δ
scanapi/evaluators/code_evaluator.py 100% <ø> (ø) ⬆️
scanapi/settings.py 80% <ø> (ø) ⬆️
scanapi/tree/root_node.py 95.45% <100%> (ø) ⬆️
scanapi/tree/request_node.py 100% <100%> (ø) ⬆️
scanapi/reporter.py 61.53% <100%> (ø) ⬆️
scanapi/tree/endpoint_node.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c62c330...aa76862. Read the comment docs.

@camilamaia
Copy link
Copy Markdown
Member Author

Good catch @barbosa, thanks. I updated it.

It was returning {} instead of None. Then, in the request headers, it was sending content-length as 2, when it should not send content-length at all
@camilamaia camilamaia merged commit 8fc1332 into master Jan 2, 2020
@camilamaia camilamaia deleted the request/no-body branch January 2, 2020 22:30
@camilamaia camilamaia mentioned this pull request Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants