summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-08-02 08:53:49 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-08-02 08:53:49 +0000
commit6e8703440e0c15034c5084439661a9b4e14bf0f9 (patch)
tree21a6d5ad38c647b596c9158835c0e73bc44fd770 /spec/services
parenta623446a09e047b73a4fc871bf5de4bb75e100ea (diff)
parent0135d57b017e4b044511249d534bd26ab77c063d (diff)
downloadgitlab-ce-6e8703440e0c15034c5084439661a9b4e14bf0f9.tar.gz
Merge branch '35815-webhook-log-encoding-error' into 'master'
Fix encoding error for WebHook logging Closes #35815 See merge request !13230
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/web_hook_service_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb
index e79c12daa1c..0d710db812c 100644
--- a/spec/services/web_hook_service_spec.rb
+++ b/spec/services/web_hook_service_spec.rb
@@ -112,6 +112,23 @@ describe WebHookService do
end
end
+ context 'with unsafe response body' do
+ before do
+ WebMock.stub_request(:post, project_hook.url).to_return(status: 200, body: "\xBB")
+ service_instance.execute
+ end
+
+ it 'log successful execution' do
+ expect(hook_log.trigger).to eq('push_hooks')
+ expect(hook_log.url).to eq(project_hook.url)
+ expect(hook_log.request_headers).to eq(headers)
+ expect(hook_log.response_body).to eq('')
+ expect(hook_log.response_status).to eq('200')
+ expect(hook_log.execution_duration).to be > 0
+ expect(hook_log.internal_error_message).to be_nil
+ end
+ end
+
context 'should not log ServiceHooks' do
let(:service_hook) { create(:service_hook) }
let(:service_instance) { described_class.new(service_hook, data, 'service_hook') }