Merge branch 'fix/user-agent-overriding' into 'develop'
Don't override user-agent header if it's been set Closes #1923 See merge request pleroma/pleroma!2829
This commit is contained in:
commit
f1f4b1863f
|
@ -34,9 +34,11 @@ def url(request, u), do: %{request | url: u}
|
||||||
@spec headers(Request.t(), Request.headers()) :: Request.t()
|
@spec headers(Request.t(), Request.headers()) :: Request.t()
|
||||||
def headers(request, headers) do
|
def headers(request, headers) do
|
||||||
headers_list =
|
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]
|
[{"user-agent", Pleroma.Application.user_agent()} | headers]
|
||||||
else
|
else
|
||||||
|
_ ->
|
||||||
headers
|
headers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue