mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Merge pull request #24926 from mrjbq7/http-fetch
http.Client: don't forget to flush
This commit is contained in:
parent
306176046e
commit
47a2f2ddae
1 changed files with 2 additions and 1 deletions
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue