Skip to content

Commit

Permalink
Add default port to ->uri (#74)
Browse files Browse the repository at this point in the history
* Add default port to ->uri

* Add changelog entry
  • Loading branch information
lvh authored Oct 23, 2024
1 parent efef896 commit 1d6affb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Babashka [http-client](https://github.com/babashka/http-client): HTTP client for

- [#71](https://github.com/babashka/http-client/issues/71): Link back to sources in release artifact
([@lread](https://github.com/lread))
- [#73](https://github.com/babashka/http-client/issues/71): Allow implicit ports when specifying the URL as a map ([@lvh](https://github.com/lvh))

## 0.4.21 (2024-09-10)

Expand Down
2 changes: 1 addition & 1 deletion src/babashka/http_client/internal/helpers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(java.net.URI. ^String (:scheme uri)
^String (:user uri)
^String (:host uri)
^Integer (:port uri)
^Integer (:port uri -1)
^String (:path uri)
^String (:query uri)
^String (:fragment uri))
Expand Down
8 changes: 8 additions & 0 deletions test/babashka/http_client/internal/helpers_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns babashka.http-client.internal.helpers-test
(:require
[babashka.http-client.internal.helpers :as h]
[clojure.test :as t]))

(t/deftest ->uri-tests
(let [uri (h/->uri {:scheme "https" :host "example.com" :path "/foo"})]
(t/is (= (.getPort uri) -1))))

0 comments on commit 1d6affb

Please sign in to comment.