Liking cljdoc? Tell your friends :D

clj-toolbox.urls


constructclj

(construct url query-params)

Takes a url and a hash-map of query-params

Returns a string of the combined url and query-params

Takes a url and a hash-map of query-params

Returns a string of the combined url and query-params
sourceraw docstring

extract-hostclj

(extract-host url)
source

get-query-paramsclj

(get-query-params url)

Gets the query params from a url and returns as a hash-map

Gets the query params from a url and returns as a hash-map
sourceraw docstring

query->mapclj

(query->map query-str)

Takes a query string and turns it into a hashmap of keywords to strings Returns nil if input is nil

Takes a query string and turns it into a hashmap of keywords to strings
Returns nil if input is nil
sourceraw docstring

splitclj

(split url)

Given a url String, split-url will return a hashmap with the following keys parsed from the given url (or nil if the url does not feature that part of the url spec) The keys in the returned map are: :host - host of the url :port - the port number of the url, or nil if not given :path - the path of the url. If the url is the root of that domain, the path will be an empty string :fragment - the fragment of url or nil if not given :query - the query string of the url or nil if not given. This is a String, but can be turned into a map with clj-toolbox.urltools/query->map :scheme - the scheme of the query e.g. "https" :user-info - the user info string of the url, or nil if not given

For an example url that includes every element:

(split-url "https://user:pword@localhost:9000/foo?a=b&x=y#helloworld")

{:host "localhost" :port 9000
 :path "/foo" :fragment "helloworld"
 :query "a=b&x=y" :scheme "https"
 :user-info "user:pword"}
 Given a url String, split-url will return a hashmap with the following keys
 parsed from the given url (or nil if the url does not feature that part of the url spec)
The keys in the returned map are:
 :host - host of the url
 :port - the port number of the url, or nil if not given
 :path - the path of the url. If the url is the root of that domain, the path will be an empty string
 :fragment - the fragment of url or nil if not given
 :query - the query string of the url or nil if not given. This is a String, but can be turned into a map with clj-toolbox.urltools/query->map
 :scheme - the scheme of the query e.g. "https"
 :user-info - the user info string of the url, or nil if not given

 For an example url that includes every element:
 ```
 (split-url "https://user:pword@localhost:9000/foo?a=b&x=y#helloworld")

 {:host "localhost" :port 9000
  :path "/foo" :fragment "helloworld"
  :query "a=b&x=y" :scheme "https"
  :user-info "user:pword"}
 ```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close