aboutsummaryrefslogtreecommitdiff
path: root/src/http/url_path.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/url_path.zig')
-rw-r--r--src/http/url_path.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/http/url_path.zig b/src/http/url_path.zig
index f2c558517..e3e90a60f 100644
--- a/src/http/url_path.zig
+++ b/src/http/url_path.zig
@@ -22,6 +22,12 @@ first_segment: string = "",
query_string: string = "",
needs_redirect: bool = false,
+pub fn isRoot(this: *const URLPath, asset_prefix: string) bool {
+ const without = this.pathWithoutAssetPrefix(asset_prefix);
+ if (without.len == 1 and without[0] == '.') return true;
+ return strings.eqlComptime(without, "index");
+}
+
// TODO: use a real URL parser
// this treats a URL like /_next/ identically to /
pub fn pathWithoutAssetPrefix(this: *const URLPath, asset_prefix: string) string {