Skip to content

Commit

Permalink
Format status lines with f-strings (#8846)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4dd8c80)
  • Loading branch information
bdraco authored and patchback[bot] committed Aug 23, 2024
1 parent 15d622c commit 5e452ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,8 @@ async def send(self, conn: "Connection") -> "ClientResponse":
self.headers[hdrs.CONNECTION] = connection

# status + headers
status_line = "{0} {1} HTTP/{v.major}.{v.minor}".format(
self.method, path, v=self.version
)
v = self.version
status_line = f"{self.method} {path} HTTP/{v.major}.{v.minor}"
await writer.write_headers(status_line, self.headers)
coro = self.write_bytes(writer, conn)

Expand Down
4 changes: 1 addition & 3 deletions aiohttp/web_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ async def _write_headers(self) -> None:
assert writer is not None
# status line
version = request.version
status_line = "HTTP/{}.{} {} {}".format(
version[0], version[1], self._status, self._reason
)
status_line = f"HTTP/{version[0]}.{version[1]} {self._status} {self._reason}"
await writer.write_headers(status_line, self._headers)

async def write(self, data: bytes) -> None:
Expand Down

0 comments on commit 5e452ca

Please sign in to comment.