Skip to content

Commit d93a065

Browse files
committed
url: improve url format
1 parent 8d6ee42 commit d93a065

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/url/url.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub const URL = struct {
6767
}
6868

6969
pub fn deinit(self: *URL, alloc: std.mem.Allocator) void {
70-
self.search_params.deinit();
70+
self.search_params.deinit(alloc);
7171
alloc.free(self.rawuri);
7272
}
7373

@@ -90,9 +90,9 @@ pub const URL = struct {
9090
.scheme = true,
9191
.authentication = true,
9292
.authority = true,
93-
.path = true,
94-
.query = true,
95-
.fragment = true,
93+
.path = self.uri.path.len > 0,
94+
.query = self.uri.query != null and self.uri.query.?.len > 0,
95+
.fragment = self.uri.fragment != null and self.uri.fragment.?.len > 0,
9696
}, buf.writer());
9797
return try buf.toOwnedSlice();
9898
}

0 commit comments

Comments
 (0)