From: Roman Chvanikov Date: Sat, 1 Aug 2020 07:04:25 +0000 (+0300) Subject: Don't override user-agent header if it's been set X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4bf44b7d657da540b25db8ac3e8906641c4242bd;p=akkoma Don't override user-agent header if it's been set --- diff --git a/lib/pleroma/http/request_builder.ex b/lib/pleroma/http/request_builder.ex index 2fc876d92..8a44a001d 100644 --- a/lib/pleroma/http/request_builder.ex +++ b/lib/pleroma/http/request_builder.ex @@ -34,10 +34,12 @@ defmodule Pleroma.HTTP.RequestBuilder do @spec headers(Request.t(), Request.headers()) :: Request.t() def headers(request, headers) do headers_list = - if Pleroma.Config.get([:http, :send_user_agent]) do + with true <- Pleroma.Config.get([:http, :send_user_agent]), + nil <- Enum.find(headers, fn {key, _val} -> String.downcase(key) == "user-agent" end) do [{"user-agent", Pleroma.Application.user_agent()} | headers] else - headers + _ -> + headers end %{request | headers: headers_list}