This commit is contained in:
parent
d1e36be9d9
commit
3370d7a063
3 changed files with 27 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ A preview of the next release can be installed from
|
|||
## Unreleased
|
||||
|
||||
- [#1592](https://github.com/babashka/babashka/issues/1592): expose `sci.core` in babashka
|
||||
- [#1596](https://github.com/babashka/babashka/issues/1596): Fix `clojure.java.browse/browse-url` truncates URLs with multiple query parameters on Windows
|
||||
|
||||
## 1.3.182 (2023-07-20)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
(case os
|
||||
:mac (sh "open" url)
|
||||
:linux (sh "xdg-open" url)
|
||||
:windows (sh "cmd" "/C" "start" url)))))
|
||||
:windows (sh "cmd" "/C" "start" (.replace url "&" "^&"))))))
|
||||
|
||||
(def browse-namespace
|
||||
{'*open-url-script* open-url-script
|
||||
|
|
|
|||
25
test/babashka/impl/clojure/java/browse_test.clj
Normal file
25
test/babashka/impl/clojure/java/browse_test.clj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(ns babashka.impl.clojure.java.browse-test
|
||||
(:require
|
||||
[babashka.test-utils :refer [bb]]
|
||||
[cheshire.core :as json]
|
||||
[clojure.test :refer [deftest is]]
|
||||
[org.httpkit.server :as http]))
|
||||
|
||||
(def ^:dynamic *http-port* 1234)
|
||||
|
||||
(deftest browse-url-test
|
||||
(let [p (promise)
|
||||
stop-server (http/run-server (fn [{:keys [query-string]}]
|
||||
(let [params (apply hash-map (mapcat #(.split % "=") (.split query-string "&")))]
|
||||
(deliver p params)
|
||||
{:status 200
|
||||
:content-type "application/json"
|
||||
:body (json/encode params)}))
|
||||
{:port *http-port*})]
|
||||
(try
|
||||
(bb nil
|
||||
(str "(clojure.java.browse/browse-url \"http://localhost:" *http-port* "?arg1=v1&arg2=v2\")"))
|
||||
(is (= {"arg1" "v1"
|
||||
"arg2" "v2"}
|
||||
(deref p 5000 ::timeout)))
|
||||
(finally (stop-server :timeout 1000)))))
|
||||
Loading…
Reference in a new issue