You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to prevent Faraday from sending its User-Agent header (Faraday v1.3.0)? I need it because one of the external servers we are dependent upon has banned it (#1247 (comment)).
Well, I know how to rewrite this header with something else per connection. Also I found how to rewrite it with something else as a default but only when there are no headers added when creating a connection (the new headers overwrite the default ones):
Faraday.default_connection_options = { headers: { user_agent: 'Something 1.2.3' } }
headers = { 'CustomHeader' => 'CustomValue' }
connection = Faraday.new('https://www.google.com', headers: headers) do |f|
f.response :logger, nil, { headers: true }
end
connection.get
I, [2021-03-15T13:41:49.910701 #7925] INFO -- request: GET https://www.google.com/
I, [2021-03-15T13:41:49.910993 #7925] INFO -- request: CustomHeader: "CustomValue" User-Agent: "Faraday v1.3.0"
But I cannot find a way as how to remove that header completely (except for monkey-patching of course). Is there one?