Skip to content

Commit ebc168c

Browse files
author
skoupidi
committed
rpc/common: use read_exact to read request/response http body
1 parent 0a74f9c commit ebc168c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/rpc/common.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ pub(super) async fn http_read_from_stream_request(
9696
// Now we know the request body size. Read it into the buffer.
9797
buf.clear();
9898
buf.resize(content_length, 0_u8);
99-
reader.read(buf).await?;
99+
reader.read_exact(buf).await?;
100100

101-
assert!(buf.len() == content_length);
102101
Ok(content_length)
103102
}
104103

@@ -170,9 +169,8 @@ pub(super) async fn http_read_from_stream_response(
170169
// Now we know the response body size. Read it into the buffer.
171170
buf.clear();
172171
buf.resize(content_length, 0_u8);
173-
reader.read(buf).await?;
172+
reader.read_exact(buf).await?;
174173

175-
assert!(buf.len() == content_length);
176174
Ok(content_length)
177175
}
178176

0 commit comments

Comments
 (0)