lib/almodovar/http_client.rb in almodovar-1.7.6 vs lib/almodovar/http_client.rb in almodovar-1.7.7

- old
+ new

@@ -36,11 +36,18 @@ request(:delete, uri, query: query, headers: merge_headers(headers)) end private - def merge_headers(headers) - (self.headers ||= {}).merge(headers) + def merge_headers(req_headers) + (default_headers || {}). + merge(self.headers ||= {}). + merge(req_headers) + end + + def default_headers + defaults = Almodovar::default_options[:headers] || {} + defaults = defaults.is_a?(Proc) ? defaults.call() : defaults end def requires_auth? username && password end