Skip to content
Snippets Groups Projects

Added headers hash for http destinations

Merged Hitesh Raghuvanshi requested to merge 436607-http-headers into master
All threads resolved!
Files
3
@@ -6,6 +6,7 @@ module ExternallyStreamable
MAXIMUM_NAMESPACE_FILTER_COUNT = 5
MAXIMUM_DESTINATIONS_PER_ENTITY = 5
STREAMING_TOKEN_HEADER_KEY = "X-Gitlab-Event-Streaming-Token"
included do
before_validation :assign_default_name
@@ -44,6 +45,25 @@ module ExternallyStreamable
where.not(id: record_id).where(category: category).limit(MAXIMUM_DESTINATIONS_PER_ENTITY).pluck(:config)
}
def headers_hash
return {} unless http?
active_headers = {}
headers = config['headers'] || {}
headers.each_key do |header|
if headers[header]['active']
active_headers[header] =
headers[header]['value']
end
+3
end
active_headers[STREAMING_TOKEN_HEADER_KEY] = secret_token
active_headers
end
private
def assign_default_name
Loading