From 161e796d6f042c743068fd004008e84fca4b7635 Mon Sep 17 00:00:00 2001 From: James Morgan Date: Thu, 17 Oct 2024 09:50:31 +0800 Subject: [PATCH] make server_header_buffer non-optional --- lib/std/http/Client.zig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/std/http/Client.zig b/lib/std/http/Client.zig index b8a4d7ee91..ed11a48e26 100644 --- a/lib/std/http/Client.zig +++ b/lib/std/http/Client.zig @@ -1666,7 +1666,7 @@ pub fn open( } pub const FetchOptions = struct { - server_header_buffer: ?[]u8 = null, + server_header_buffer: []u8, redirect_behavior: ?Request.RedirectBehavior = null, /// If the server sends a body, it will be appended to this ArrayList. @@ -1712,13 +1712,11 @@ pub fn fetch(client: *Client, options: FetchOptions) !Response { .url => |u| try Uri.parse(u), .uri => |u| u, }; - var server_header_buffer: [16 * 1024]u8 = undefined; - const method: http.Method = options.method orelse if (options.payload != null) .POST else .GET; var req = try open(client, method, uri, .{ - .server_header_buffer = options.server_header_buffer orelse &server_header_buffer, + .server_header_buffer = options.server_header_buffer, .redirect_behavior = options.redirect_behavior orelse if (options.payload == null) @enumFromInt(3) else .unhandled, .headers = options.headers,