Commit 65e2e1b5 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'gregmyers-webhook-useragent' into 'master'

Add User-Agent to web hook service

See merge request gitlab-org/gitlab!46070
parents 9515f472 e92dbcf7
...@@ -120,6 +120,7 @@ class WebHookService ...@@ -120,6 +120,7 @@ class WebHookService
@headers ||= begin @headers ||= begin
{ {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'User-Agent' => "GitLab/#{Gitlab::VERSION}",
GITLAB_EVENT_HEADER => self.class.hook_to_event(hook_name) GITLAB_EVENT_HEADER => self.class.hook_to_event(hook_name)
}.tap do |hash| }.tap do |hash|
hash['X-Gitlab-Token'] = Gitlab::Utils.remove_line_breaks(hook.token) if hook.token.present? hash['X-Gitlab-Token'] = Gitlab::Utils.remove_line_breaks(hook.token) if hook.token.present?
......
---
title: Add User-Agent to web hook service
merge_request: 46070
author:
type: added
...@@ -10,6 +10,7 @@ RSpec.describe WebHookService do ...@@ -10,6 +10,7 @@ RSpec.describe WebHookService do
let(:headers) do let(:headers) do
{ {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'User-Agent' => "GitLab/#{Gitlab::VERSION}",
'X-Gitlab-Event' => 'Push Hook' 'X-Gitlab-Event' => 'Push Hook'
} }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment