Skip to content
Snippets Groups Projects
Unverified Commit eeec7540 authored by Cam Saül's avatar Cam Saül
Browse files

More minor cleanup :shower:

parent 8c23bf92
Branches
Tags
No related merge requests found
......@@ -28,7 +28,7 @@
[request-fn url & {:as options}]
{:pre [(fn? request-fn) (string? url)]}
(let [options (cond-> (merge {:content-type "application/json"} options)
(:body options) (update :body json/generate-string))
(:body options) (update :body json/generate-string))
{:keys [status body]} (request-fn url options)]
(when (not= status 200)
(throw (Exception. (format "Error [%d]: %s" status body))))
......
......@@ -300,11 +300,14 @@
You may optionally pass any of the OPTIONS below:
* `:default` - The default value of the setting. (default: `nil`)
* `:type` - Either `:string` (default) or `:boolean`. Non-string settings have special default getters and setters that automatically coerce values to the correct types.
* `:type` - `:string` (default), `:boolean`, or `:json`. Non-`:string` settings have special default getters and setters that automatically coerce values to the correct types.
* `:internal?` - This `Setting` is for internal use and shouldn't be exposed in the UI (i.e., not
returned by the corresponding endpoints). Default: `false`
* `:getter` - A custom getter fn, which takes no arguments. Overrides the default implementation.
* `:setter` - A custom setter fn, which takes a single argument. Overrides the default implementation."
(This can in turn call functions in this namespace like `get-string` or `get-boolean` to invoke the default getter behavior.)
* `:setter` - A custom setter fn, which takes a single argument. Overrides the default implementation.
(This can in turn call functions in this namespace like `set-string!` or `set-boolean!` to invoke the default setter behavior.
Keep in mind that the custom setter may be passed `nil`, which should clear the values of the Setting.)"
{:style/indent 1}
[setting-symb description & {:as options}]
{:pre [(symbol? setting-symb) (string? description)]}
......
......@@ -69,6 +69,7 @@
(expect true (is-url? "http://www.cool.com"))
(expect true (is-url? "http://localhost/"))
(expect true (is-url? "http://localhost:3000"))
(expect true (is-url? "https://www.mapbox.com/help/data/stations.geojson"))
(expect true (is-url? "http://www.cool.com:3000"))
(expect true (is-url? "http://localhost:3000/auth/reset_password/144_f98987de-53ca-4335-81da-31bb0de8ea2b#new"))
(expect false (is-url? "google.com")) ; missing protocol
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment