Fork me on GitHub
#lambdaisland
<
2020-07-18
>
plexus05:07:51

So you're building up urls from scratch? Data going into the path or into the query string?

drewverlee18:07:22

Yes and in this case both. The goal is to have the url be a datastructure e.g map that we can add (path,query params) and then prior to use in a http call be converted to a url encoded string. Your lib (ty btw) seems to do all this as well. Though i need ot read the docs again to confirm that the encoding/percent-encoding happens when i join or assoc-query*. another clojurescript lib that does this is cmeriks/url.

plexus04:07:12

assoc-query does, but doing (assoc uri :path ...) it won't, since that's just updating the field in the record. But you can assoc the path and then normalize. I wrote lambdaisland/uri as an as alternative to cemerick/url for three reasons : cross platform cljc, the ability to represent and manipulate relative urls, and an implementation of the rfc algorithm for joining urls (e.g. resolving links)

plexus10:07:50

assoc-query came later, might be nice to add a conj-path that adds path segments and that encodes them, similar to assoc-query