Skip to content

Instantly share code, notes, and snippets.

@practice
Last active May 10, 2017 09:50
Show Gist options
  • Save practice/319fa51d790ee8aa08a414b8608e2d78 to your computer and use it in GitHub Desktop.
Save practice/319fa51d790ee8aa08a414b8608e2d78 to your computer and use it in GitHub Desktop.
URI test
(let [uri (URI. "ceds://host.net/path1/p2?quiet#myidw")]
[(.getHost uri) (.getPath uri) (.getScheme uri) (.getQuery uri) (.getFragment uri)])
==> ["host.net" "/path1/p2" "ceds" "quiet" "myidw"]
@practice
Copy link
Author

practice commented May 10, 2017

(let [uri (URI. "ceds:/path1/p2?quiet#myidw")
      rel "./path3/path4/../path5"
      uri (.resolve uri rel)]
  [(.getScheme uri) (.getHost uri) (.getPath uri) (.getQuery uri) (.getFragment uri)])
=> ["ceds" nil "/path1/path3/path5" nil nil]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment