Skip to content

Commit eda77d1

Browse files
committed
add getHostname
1 parent 5112c4c commit eda77d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/url.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ pub const URL = struct {
6969
return ada.getHref(self.internal);
7070
}
7171

72-
pub fn hostname(self: URL) []const u8 {
73-
return ada.getHostname(self.internal);
72+
pub fn getHostname(self: URL) []const u8 {
73+
const hostname = ada.getHostnameNullable(self.internal);
74+
return hostname.data[0..hostname.length];
7475
}
7576

7677
pub fn getFragment(self: URL) ?[]const u8 {

0 commit comments

Comments
 (0)