Status: done Completed: 2026-02-18 Priority: P1 Created: 2026-02-18 Owner: conductor
url->route-target in route_url.cljc uses js/URL for URL parsing and is CLJS-only (returns nil on CLJ). For headless testing, the CLJ branch must parse URLs using java.net.URI. The function already accepts an href argument (1-arity), so only the parsing implementation needs a CLJ branch.
Add CLJ branch to url->route-target using java.net.URI:
_p parameter → decode via decode-params{:leaf-name :segments :params}Add CLJ import: (:import (java.net URI)) in reader conditional
current-url-path should also get a CLJ branch (used indirectly) — same java.net.URI approach for the 1-arity form that takes an href
The 0-arity forms (which call current-url) remain CLJS-only (they read from the browser). Headless callers always pass an explicit href.
integration/fulcro/route_url.cljc — url->route-target, current-url-path, ns importsAdd #?(:clj ...) branches alongside existing #?(:cljs ...) in the 1-arity forms. Use java.net.URI for path extraction and manual query string parsing (split on &, find _p= key). The decode-params function already works on CLJ.
(url->route-target "http://localhost/Dashboard") → {:leaf-name "Dashboard" :segments ["Dashboard"]}(url->route-target "http://localhost/Admin/Users?_p=encoded") → correct segments + decoded params(url->route-target "http://localhost/") → nil (no segments)(url->route-target "/Dashboard") → works with relative paths (java.net.URI handles this)(current-url-path "http://localhost/Foo/Bar") → ["Foo" "Bar"]Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |