http: request builder: send user-agent when making requests
authorWilliam Pitcock <nenolod@dereferenced.org>
Fri, 17 May 2019 19:03:19 +0000 (19:03 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Fri, 17 May 2019 19:04:17 +0000 (19:04 +0000)
lib/pleroma/http/request_builder.ex

index 5f2cff2c0d461be23195d0026cba2ad5ea49488b..522728da194d985f50fa24638a0d3667709feb4b 100644 (file)
@@ -45,8 +45,9 @@ defmodule Pleroma.HTTP.RequestBuilder do
   Add headers to the request
   """
   @spec headers(map(), list(tuple)) :: map()
-  def headers(request, h) do
-    Map.put_new(request, :headers, h)
+  def headers(request, header_list) do
+    header_list = header_list ++ [{"User-Agent", Pleroma.Application.user_agent()}]
+    Map.put_new(request, :headers, header_list)
   end
 
   @doc """