Fix type of fields_attributes

Convert tuple list to map list when parameters is `:urlencoded` or `:multipart`
This commit is contained in:
kPherox 2019-08-25 07:02:32 +09:00
parent 45e21a9df4
commit 705b5adfc4
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D
1 changed files with 7 additions and 0 deletions

View File

@ -143,6 +143,13 @@ def update_credentials(%{assigns: %{user: user}} = conn, params) do
|> Enum.concat(Formatter.get_emoji_map(emojis_text)) |> Enum.concat(Formatter.get_emoji_map(emojis_text))
|> Enum.dedup() |> Enum.dedup()
params =
if Map.has_key?(params, "fields_attributes") && Enum.all?(params["fields_attributes"], &is_tuple/1) do
Map.update!(params, "fields_attributes", &Enum.map(&1, fn {_, v} -> v end))
else
params
end
info_params = info_params =
[ [
:no_rich_text, :no_rich_text,