From 438d680913393d42754ea1d27c7c50ef1698d0ff Mon Sep 17 00:00:00 2001 From: Piotr Sarna Date: Mon, 19 Jun 2023 11:31:30 +0200 Subject: [PATCH] http: fix getting Transfer-Encoding value The 'Content-Length' header was inspected by mistake, which makes it effectively impossible to use chunked Transfer-Encoding when using the http client. Tested locally with a HTTP server - data is properly sent with POST method and the proper encoding declared, after the fix. --- lib/std/http/Client.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig index 0c627642b8..942ff4904d 100644 --- a/lib/std/http/Client.zig +++ b/lib/std/http/Client.zig @@ -597,7 +597,7 @@ pub const Request = struct { req.transfer_encoding = .{ .content_length = content_length }; } else if (has_transfer_encoding) { - const transfer_encoding = req.headers.getFirstValue("content-length").?; + const transfer_encoding = req.headers.getFirstValue("transfer-encoding").?; if (std.mem.eql(u8, transfer_encoding, "chunked")) { req.transfer_encoding = .chunked; } else {