srctree

Gregory Mullen parent e884ea52 250818b6
remove error from cookie.jar.init

inlinesplit
src/cookies.zig added: 9, removed: 10, total 0
@@ -161,16 +161,15 @@ pub const Jar = struct {
cookies: ArrayListUnmanaged(Cookie),
 
/// Creates a new jar.
pub fn init(a: Allocator) !Jar {
const cookies = try ArrayListUnmanaged(Cookie).initCapacity(a, 8);
pub fn init(a: Allocator) Jar {
return .{
.alloc = a,
.cookies = cookies,
.cookies = .{},
};
}
 
pub fn initFromHeader(a: Allocator, header: []const u8) !Jar {
var jar = try init(a);
var jar: Jar = .init(a);
var cookies = splitSequence(u8, header, "; ");
while (cookies.next()) |cookie| {
try jar.add(Cookie.fromHeader(cookie));
@@ -235,7 +234,7 @@ pub const Jar = struct {
 
test Jar {
const a = std.testing.allocator;
var j = try Jar.init(a);
var j: Jar = .init(a);
defer j.raze();
 
const cookies = [_]Cookie{
 
src/frame.zig added: 9, removed: 10, total 0
@@ -197,7 +197,7 @@ pub fn init(a: Allocator, req: *const Request, auth: Auth.Provider) !Frame {
.auth_provider = auth,
.headers = Headers.init(),
.user = auth.authenticate(&req.headers) catch null,
.cookie_jar = try Cookies.Jar.init(a),
.cookie_jar = .init(a),
.response_data = ResponseData.init(a),
};
}
 
src/request.zig added: 9, removed: 10, total 0
@@ -143,7 +143,7 @@ fn initCommon(
.accept = accept,
.accept_encoding = accept_encoding,
.authorization = authorization,
.cookie_jar = if (cookies) |ch| try Cookies.Jar.initFromHeader(a, ch) else try Cookies.Jar.init(a),
.cookie_jar = if (cookies) |ch| try .initFromHeader(a, ch) else .init(a),
.data = data,
.headers = headers,
.host = host,