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 3122fd0 commit 919a3baCopy full SHA for 919a3ba
lib/std/http/Client.zig
@@ -1018,9 +1018,11 @@ pub const Request = struct {
1018
pub fn write(req: *Request, bytes: []const u8) WriteError!usize {
1019
switch (req.transfer_encoding) {
1020
.chunked => {
1021
- try req.connection.?.writer().print("{x}\r\n", .{bytes.len});
1022
- try req.connection.?.writer().writeAll(bytes);
1023
- try req.connection.?.writer().writeAll("\r\n");
+ if (bytes.len > 0) {
+ try req.connection.?.writer().print("{x}\r\n", .{bytes.len});
+ try req.connection.?.writer().writeAll(bytes);
1024
+ try req.connection.?.writer().writeAll("\r\n");
1025
+ }
1026
1027
return bytes.len;
1028
},
0 commit comments