diff --git a/src/tests/test_sendfile.zig b/src/tests/test_sendfile.zig index d368696..8b16a8a 100644 --- a/src/tests/test_sendfile.zig +++ b/src/tests/test_sendfile.zig @@ -7,20 +7,16 @@ var read_len: ?usize = null; const testfile = @embedFile("testfile.txt"); fn makeRequest(a: std.mem.Allocator, url: []const u8) !void { - const uri = try std.Uri.parse(url); - - var h = std.http.Headers{ .allocator = a }; - defer h.deinit(); - var http_client: std.http.Client = .{ .allocator = a }; defer http_client.deinit(); - - var req = try http_client.open(.GET, uri, h, .{}); - defer req.deinit(); - - try req.send(.{}); - try req.wait(); - read_len = try req.readAll(&buffer); + var response = std.ArrayList(u8).init(a); + defer response.deinit(); + _ = try http_client.fetch(.{ + .location = .{ .url = url }, + .response_storage = .{ .dynamic = &response }, + }); + read_len = response.items.len; + @memcpy(buffer[0..read_len.?], response.items); zap.stop(); }