Merge branch 's3-namespace' into 'develop'
[akkoma] / lib / pleroma / http / request_builder.ex
index 5aee2b8ae5b0d250e13e834d31e3de4283dc64bb..5f2cff2c0d461be23195d0026cba2ad5ea49488b 100644 (file)
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.HTTP.RequestBuilder do
   @moduledoc """
   Helper functions for building Tesla requests
@@ -96,6 +100,8 @@ defmodule Pleroma.HTTP.RequestBuilder do
   Map
   """
   @spec add_param(map(), atom, atom, any()) :: map()
+  def add_param(request, :query, :query, values), do: Map.put(request, :query, values)
+
   def add_param(request, :body, :body, value), do: Map.put(request, :body, value)
 
   def add_param(request, :body, key, value) do
@@ -103,7 +109,10 @@ defmodule Pleroma.HTTP.RequestBuilder do
     |> Map.put_new_lazy(:body, &Tesla.Multipart.new/0)
     |> Map.update!(
       :body,
-      &Tesla.Multipart.add_field(&1, key, Poison.encode!(value),
+      &Tesla.Multipart.add_field(
+        &1,
+        key,
+        Jason.encode!(value),
         headers: [{:"Content-Type", "application/json"}]
       )
     )