summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/couch.ex12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/couch.ex b/lib/couch.ex
index 71f86a3..e33c045 100644
--- a/lib/couch.ex
+++ b/lib/couch.ex
@@ -73,9 +73,17 @@ defmodule Couch do
config = Application.get_env(:lsg, :couch)
base_url = Keyword.get(config, :url, "http://localhost:5984")
- url = URI.merge(base_url, Path.join(path)) |> to_string()
- headers = headers ++ [{"accept", "application/json"}, {"user-agent", "beautte"}]
+ path = path
+ |> Enum.filter(& &1)
+ |> Enum.map(fn(url) -> String.replace("/", "%2F") end)
+ |> Path.join()
+
+ url = base_url
+ |> URI.merge(path)
+ |> to_string()
+
+ headers = headers ++ [{"accept", "application/json"}, {"user-agent", "#{Nola.brand(:name)} v#{Nola.version()}"}]
params = Enum.map(params, fn({k, v}) -> {to_string(k), v} end)
client_options = Keyword.get(config, :client_options, [])