mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-27 00:09:35 +00:00
Don't override user-agent header if it's been set
This commit is contained in:
parent
a1a43f39dc
commit
4bf44b7d65
|
@ -34,9 +34,11 @@ 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
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue