projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'feat/format-optional-migrations' into 'develop'
[akkoma]
/
lib
/
pleroma
/
http
/
request_builder.ex
diff --git
a/lib/pleroma/http/request_builder.ex
b/lib/pleroma/http/request_builder.ex
index 5b92ce7648680e1979328ec2a26149cb9089a3fb..8a44a001dbabc87e41f4f17936d5879af343cda6 100644
(file)
--- a/
lib/pleroma/http/request_builder.ex
+++ b/
lib/pleroma/http/request_builder.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.HTTP.RequestBuilder do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.HTTP.RequestBuilder do
@@
-34,10
+34,12
@@
defmodule Pleroma.HTTP.RequestBuilder do
@spec headers(Request.t(), Request.headers()) :: Request.t()
def headers(request, headers) do
headers_list =
@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
[{"user-agent", Pleroma.Application.user_agent()} | headers]
else
- headers
+ _ ->
+ headers
end
%{request | headers: headers_list}
end
%{request | headers: headers_list}