fix response post issue introduced by new client

This commit is contained in:
Emil Lerch 2023-08-01 19:50:02 -07:00
parent 580c7a1165
commit 9a0f564e84
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -174,8 +174,10 @@ pub fn run(allocator: ?std.mem.Allocator, event_handler: HandlerFn) !void { // T
const response_content = try std.fmt.allocPrint(req_allocator, "{s} \"content\": \"{s}\" {s}", .{ "{", event_response, "}" });
var resp_req = try client.request(.POST, response_uri, empty_headers, .{});
defer resp_req.deinit();
resp_req.transfer_encoding = .{ .content_length = response_content.len };
try resp_req.start();
try resp_req.writeAll(response_content); // TODO: AllocPrint + writeAll makes no sense
try resp_req.finish();
resp_req.wait() catch |err| {
// TODO: report error
log.err("Error posting response for request id {s}: {}", .{ req_id, err });