Merge pull request #24926 from mrjbq7/http-fetch

http.Client: don't forget to flush
This commit is contained in:
John Benediktsson 2025-08-22 12:35:18 -07:00 committed by GitHub
parent 306176046e
commit 47a2f2ddae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1797,9 +1797,10 @@ pub fn fetch(client: *Client, options: FetchOptions) FetchError!FetchResult {
if (options.payload) |payload| { if (options.payload) |payload| {
req.transfer_encoding = .{ .content_length = payload.len }; req.transfer_encoding = .{ .content_length = payload.len };
var body = try req.sendBody(&.{}); var body = try req.sendBodyUnflushed(&.{});
try body.writer.writeAll(payload); try body.writer.writeAll(payload);
try body.end(); try body.end();
try req.connection.?.flush();
} else { } else {
try req.sendBodiless(); try req.sendBodiless();
} }