lambdaisland / uri

A pure Clojure/ClojureScript URI library
Mozilla Public License 2.0
243 stars 21 forks source link

Accept port as an empty string #9

Closed ashwinbhaskar closed 4 years ago

ashwinbhaskar commented 5 years ago
(str (-> (uri "/v1/payment")
         (assoc :scheme "https")
         (assoc :host "my.domain.org")
         (assoc :port "")))

results in "https://my.domain.org:/v1/payment"

The extra : in the url causes a problem.

Ideally it should just ignore a blank port.

plexus commented 5 years ago

This seems to me like a "garbage in, garbage out" problem. Specs would be useful here though, since port should really be an integer.

ashwinbhaskar commented 5 years ago

@plexus This is useful when you have your configurations externalised. I actually ran into this problem when our configurations where externalised. They are read from a central repository. Specifying nil is not possible there. Anyway, I have created a PR.

ashwinbhaskar commented 5 years ago

Any updates here? @plexus