More efficiently remove trailing newline from message
This commit is contained in:
parent
0ebc8ffb21
commit
20dd7d777a
|
@ -34,11 +34,7 @@ class RawConnection(IRawConnection):
|
||||||
|
|
||||||
async def read(self) -> bytes:
|
async def read(self) -> bytes:
|
||||||
line = await self.reader.readline()
|
line = await self.reader.readline()
|
||||||
adjusted_line = line.decode().rstrip("\n")
|
return line.rstrip(b"\n")
|
||||||
|
|
||||||
# TODO: figure out a way to remove \n without going back and forth with
|
|
||||||
# encoding and decoding
|
|
||||||
return adjusted_line.encode()
|
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
self.writer.close()
|
self.writer.close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user