url: improve url format

This commit is contained in:
Pierre Tachoire
2024-05-13 16:06:41 +02:00
parent 8d6ee42096
commit d93a065db9

View File

@@ -67,7 +67,7 @@ pub const URL = struct {
}
pub fn deinit(self: *URL, alloc: std.mem.Allocator) void {
self.search_params.deinit();
self.search_params.deinit(alloc);
alloc.free(self.rawuri);
}
@@ -90,9 +90,9 @@ pub const URL = struct {
.scheme = true,
.authentication = true,
.authority = true,
.path = true,
.query = true,
.fragment = true,
.path = self.uri.path.len > 0,
.query = self.uri.query != null and self.uri.query.?.len > 0,
.fragment = self.uri.fragment != null and self.uri.fragment.?.len > 0,
}, buf.writer());
return try buf.toOwnedSlice();
}