We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a696b4 commit 837188fCopy full SHA for 837188f
src/http/client.zig
@@ -1576,6 +1576,19 @@ pub const Response = struct {
1576
}
1577
1578
pub fn peek(self: *Response) ![]u8 {
1579
+ if (try self.processData()) |data| {
1580
+ // We already have some or all of the body. This happens because
1581
+ // we always read as much as we can, so getting the header and
1582
+ // part/all of the body is normal.
1583
+ if (data.len > 100) {
1584
+ self._peek_buf = data;
1585
+ self._peek_len = data.len;
1586
+ return data;
1587
+ }
1588
+ @memcpy(self._peek_buf[0..data.len], data);
1589
1590
1591
+
1592
while (true) {
1593
var peek_buf = self._peek_buf;
1594
const peek_len = self._peek_len;
0 commit comments