projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a1a43f3
)
Don't override user-agent header if it's been set
author
Roman Chvanikov
<chvanikoff@pm.me>
Sat, 1 Aug 2020 07:04:25 +0000
(10:04 +0300)
committer
Roman Chvanikov
<chvanikoff@pm.me>
Sat, 1 Aug 2020 07:04:25 +0000
(10:04 +0300)
lib/pleroma/http/request_builder.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/http/request_builder.ex
b/lib/pleroma/http/request_builder.ex
index 2fc876d924017f9d55a8d5d9cf3dd108e22fff02..8a44a001dbabc87e41f4f17936d5879af343cda6 100644
(file)
--- 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}