const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const Client = std.http.Client; const Reader = Request.Reader; const Request = Client.Request; const Uri = std.Uri; pub fn get(parent_allocator: Allocator, uri: Uri) ![]u8 { var arena = ArenaAllocator.init(parent_allocator); defer arena.deinit(); const allocator = arena.allocator(); var client = Client{ .allocator = allocator, }; defer client.deinit(); var server_header_buffer: [4096]u8 = undefined; var request = try client.open(.GET, uri, .{ .server_header_buffer = &server_header_buffer, }); defer request.deinit(); try request.send(); try request.wait(); return request.reader().readAllAlloc(parent_allocator, std.math.maxInt(usize)); }