X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fhttp%2Frequest_builder.ex;h=2fc876d924017f9d55a8d5d9cf3dd108e22fff02;hb=908cf22a6cb07044eb0fb44c9673c8adcf22c0db;hp=491acd0f9fbcc67fb282efdf23ea1efa3ab1f50d;hpb=509c81e4b10bd8ba6d3a93889cd6fbbbfbcbab21;p=akkoma
diff --git a/lib/pleroma/http/request_builder.ex b/lib/pleroma/http/request_builder.ex
index 491acd0f9..2fc876d92 100644
--- a/lib/pleroma/http/request_builder.ex
+++ b/lib/pleroma/http/request_builder.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.HTTP.RequestBuilder do
@@ -35,7 +35,7 @@ defmodule Pleroma.HTTP.RequestBuilder do
def headers(request, headers) do
headers_list =
if Pleroma.Config.get([:http, :send_user_agent]) do
- headers ++ [{"user-agent", Pleroma.Application.user_agent()}]
+ [{"user-agent", Pleroma.Application.user_agent()} | headers]
else
headers
end
@@ -49,26 +49,6 @@ defmodule Pleroma.HTTP.RequestBuilder do
@spec opts(Request.t(), keyword()) :: Request.t()
def opts(request, options), do: %{request | opts: options}
- # NOTE: isn't used anywhere
- @doc """
- Add optional parameters to the request
-
- """
- @spec add_optional_params(Request.t(), %{optional(atom) => atom}, keyword()) :: map()
- def add_optional_params(request, _, []), do: request
-
- def add_optional_params(request, definitions, [{key, value} | tail]) do
- case definitions do
- %{^key => location} ->
- request
- |> add_param(location, key, value)
- |> add_optional_params(definitions, tail)
-
- _ ->
- add_optional_params(request, definitions, tail)
- end
- end
-
@doc """
Add optional parameters to the request
"""