def take_auth.go
import bend-kit-url@0.4.1.0/url.bend as Urlimport Base
292# §3.2: the authority runs to the first "/", "?" or "#".
293def take_auth.go(s: String, acc: String, hit: Bool) -> String & String:
294 match s:
295 case SNil{}:
296 match hit:
297 case True{}:
298 take.back(acc, SNil{})
299 case False{}:
300 (String.reverse(acc), SNil{})
301 case SCon{Chr{+c}, t}:
302 match hit:
303 case True{}:
304 take.back(acc, SCon{Chr{c}, t})
305 case False{}:
306 take_auth.go(t, SCon{Chr{c}, acc}, auth_end(c))