Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Add content-length header for http2 connections #208

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hyper/http20/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def request(self, method, url, body=None, headers={}):
# Convert the body to bytes if needed.
if body and isinstance(body, (unicode, bytes)):
body = to_bytestring(body)
if 'Transfer-Encoding' not in headers.keys():

Choose a reason for hiding this comment

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

Any reason why we need O(n) here? Would it be better to just use:

if 'Transfer-Encoding' not in headers:
    ....

self.putheader('Content-Length', str(len(body)))

self.endheaders(message_body=body, final=True, stream_id=stream_id)

Expand Down