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

Don't send body in response to HEAD request #838

Merged
merged 2 commits into from
May 23, 2016
Merged

Don't send body in response to HEAD request #838

merged 2 commits into from
May 23, 2016

Conversation

lgelo
Copy link
Contributor

@lgelo lgelo commented Mar 21, 2016

What these changes does?

Skips sending Response body when request method is HEAD or status code is 204 or 304. Satisfies requirements of RFC7230 an RFC7231 that server MUST NOT send message body in such responses.

How to test your changes?

Test case is included:
test_head_returns_empty_body (tests/test_web_functional.py)

Related issue number

Problems with HEAD responses #820

Checklist

  • Code is written and well
  • Tests for the changes are provided
  • Documentation reflects the changes

@@ -851,11 +851,15 @@ def text(self, text):

self.body = text.encode(self.charset)

def should_send_body(self):
return (self._req.method.lower() != 'head' and
Copy link
Member

Choose a reason for hiding this comment

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

No need to convert to lowercase, please use hdrs.METH_HEAD instead

@popravich popravich added the web label Mar 22, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.001%) to 98.265% when pulling a7d5995 on lgelo:master into a1f39a9 on KeepSafe:master.

@fafhrd91 fafhrd91 merged commit 83975df into aio-libs:master May 23, 2016
@fafhrd91
Copy link
Member

thanks

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants