Skip to content

Commit

Permalink
better naming and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
BYK committed Nov 16, 2024
1 parent f90010e commit fb65910
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hpack/hpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ def _dict_to_iterable(header_dict):
yield key, header_dict[key]


def _to_bytes(string):
def _to_bytes(value):
"""
Convert string to bytes.
Convert anything to bytes through a UTF-8 encoded string
"""
t = type(string)
t = type(value)
if t is bytes:
return string
return value
if t is not str:
string = str(string)
return string.encode("utf-8")
value = str(value)
return value.encode("utf-8")


class Encoder:
Expand Down

0 comments on commit fb65910

Please sign in to comment.