Skip to content

Commit 0fe7bd7

Browse files
committed
Fix: Wrong typing and return type in HTTPResponse._construct_response_bytes
1 parent 6585d3f commit 0fe7bd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_httpserver/response.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def _construct_response_bytes( # pylint: disable=too-many-arguments
6767
content_length: Union[int, None] = None,
6868
headers: Dict[str, str] = None,
6969
body: str = "",
70-
) -> str:
71-
"""Send the constructed response over the given socket."""
70+
) -> bytes:
71+
"""Constructs the response bytes from the given parameters."""
7272

7373
response = f"{http_version} {status.code} {status.text}\r\n"
7474

@@ -83,7 +83,7 @@ def _construct_response_bytes( # pylint: disable=too-many-arguments
8383

8484
response += f"\r\n{body}"
8585

86-
return response
86+
return response.encode("utf-8")
8787

8888
def send(self, conn: Union["SocketPool.Socket", "socket.socket"]) -> None:
8989
"""

0 commit comments

Comments
 (0)