Permalink
Browse files

We can handle a trailing slash in base-url, too

  • Loading branch information...
1 parent e06f2cd commit 41ab423854400a5910bad8467a965f58428e7a4f @jcrossley3 jcrossley3 committed Sep 15, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 test/hiccup/test/util.clj
@@ -38,6 +38,14 @@
(is (= (to-str (to-uri "https://example.com/bar")) "https://example.com/bar"))
(is (= (to-str (to-uri "bar")) "bar"))
(is (= (to-str (to-uri "../bar")) "../bar"))
+ (is (= (to-str (to-uri "//example.com/bar")) "//example.com/bar"))))
+ (testing "with base URL containing trailing slash"
+ (with-base-url "/foo/"
+ (is (= (to-str (to-uri "/bar")) "/foo/bar"))
+ (is (= (to-str (to-uri "http://example.com")) "http://example.com"))
+ (is (= (to-str (to-uri "https://example.com/bar")) "https://example.com/bar"))
+ (is (= (to-str (to-uri "bar")) "bar"))
+ (is (= (to-str (to-uri "../bar")) "../bar"))
(is (= (to-str (to-uri "//example.com/bar")) "//example.com/bar")))))
(deftest test-url-encode

0 comments on commit 41ab423

Please sign in to comment.