Skip to content

Commit

Permalink
Fix query expander
Browse files Browse the repository at this point in the history
  • Loading branch information
sirikid committed Aug 22, 2023
1 parent 66846ed commit 0109b38
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/yuri_template/query_expander.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ defmodule YuriTemplate.QueryExpander do
expand(acc, substitutes, vars)

{:ok, value} ->
value = if is_map(value), do: Enum.to_list(value), else: value

case value do
[{k1, v1} | kvs] ->
Enum.reduce(
kvs,
[acc, "?", k1, "=", encode(v1)],
fn {k, v}, acc -> [acc, "&", k, "=", encode(v)] end
[acc, "?", to_string(k1), "=", encode(v1)],
fn {k, v}, acc -> [acc, "&", to_string(k), "=", encode(v)] end
)

[v1 | vs] ->
Expand Down

0 comments on commit 0109b38

Please sign in to comment.