diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-12 18:26:01 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-12 18:34:46 +0800 |
commit | 542510aa484ecbc6c11c513289e95a151e59783d (patch) | |
tree | 162e94b97621dfbf84594fe2d9945273bee84cc6 /router.go | |
parent | ssh.go: Add anonymous SSH cloning (diff) | |
download | forge-542510aa484ecbc6c11c513289e95a151e59783d.tar.gz forge-542510aa484ecbc6c11c513289e95a151e59783d.tar.zst forge-542510aa484ecbc6c11c513289e95a151e59783d.zip |
http_router.go: Move from router.go and fix conditional placement bug
Diffstat (limited to '')
-rw-r--r-- | router_http.go (renamed from router.go) | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/router.go b/router_http.go index c843698..abf47c2 100644 --- a/router.go +++ b/router_http.go @@ -16,12 +16,12 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - if len(segments) < 2 { - http.Error(w, "Blank system endpoint", http.StatusNotFound) - return - } - if segments[0] == ":" { + if len(segments) < 2 { + http.Error(w, "Blank system endpoint", http.StatusNotFound) + return + } + switch segments[1] { case "static": static_handler.ServeHTTP(w, r) |