add getHostname

This commit is contained in:
Halil Durak
2025-10-14 12:12:36 +03:00
parent 9b3be14650
commit 9e7e9b67ff

View File

@@ -69,8 +69,9 @@ pub const URL = struct {
return ada.getHref(self.internal); return ada.getHref(self.internal);
} }
pub fn hostname(self: URL) []const u8 { pub fn getHostname(self: URL) []const u8 {
return ada.getHostname(self.internal); const hostname = ada.getHostnameNullable(self.internal);
return hostname.data[0..hostname.length];
} }
pub fn getFragment(self: URL) ?[]const u8 { pub fn getFragment(self: URL) ?[]const u8 {