zig 0.12.0: update interface for headergate
This commit is contained in:
parent
decb2d34af
commit
d72b5f6b6f
|
@ -4,7 +4,7 @@ pub const HandlerFn = *const fn (std.mem.Allocator, []const u8, Context) anyerro
|
||||||
|
|
||||||
pub const Response = struct {
|
pub const Response = struct {
|
||||||
allocator: std.mem.Allocator,
|
allocator: std.mem.Allocator,
|
||||||
headers: std.http.Headers,
|
headers: []const std.http.Header,
|
||||||
headers_owned: bool = true,
|
headers_owned: bool = true,
|
||||||
status: std.http.Status = .ok,
|
status: std.http.Status = .ok,
|
||||||
reason: ?[]const u8 = null,
|
reason: ?[]const u8 = null,
|
||||||
|
@ -15,7 +15,7 @@ pub const Response = struct {
|
||||||
/// that here
|
/// that here
|
||||||
request: struct {
|
request: struct {
|
||||||
target: []const u8 = "/",
|
target: []const u8 = "/",
|
||||||
headers: std.http.Headers,
|
headers: []const std.http.Header,
|
||||||
headers_owned: bool = true,
|
headers_owned: bool = true,
|
||||||
method: std.http.Method = .GET,
|
method: std.http.Method = .GET,
|
||||||
},
|
},
|
||||||
|
@ -37,9 +37,9 @@ pub const Response = struct {
|
||||||
pub fn init(allocator: std.mem.Allocator) Response {
|
pub fn init(allocator: std.mem.Allocator) Response {
|
||||||
return .{
|
return .{
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.headers = .{ .allocator = allocator },
|
.headers = &.{},
|
||||||
.request = .{
|
.request = .{
|
||||||
.headers = .{ .allocator = allocator },
|
.headers = &.{},
|
||||||
},
|
},
|
||||||
.body = std.ArrayList(u8).init(allocator),
|
.body = std.ArrayList(u8).init(allocator),
|
||||||
};
|
};
|
||||||
|
@ -61,8 +61,8 @@ pub const Response = struct {
|
||||||
}
|
}
|
||||||
pub fn deinit(res: *Response) void {
|
pub fn deinit(res: *Response) void {
|
||||||
res.body.deinit();
|
res.body.deinit();
|
||||||
if (res.headers_owned) res.headers.deinit();
|
if (res.headers_owned) res.allocator.free(res.headers);
|
||||||
if (res.request.headers_owned) res.request.headers.deinit();
|
if (res.request.headers_owned) res.allocator.free(res.request.headers);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user