Commit b27e5497 authored by Patrick Derichs's avatar Patrick Derichs Committed by Sean McGivern

Fix user agent string for Hosted Jira

parent 13ec1bcb
---
title: Fix user agent string for Hosted Jira
merge_request: 10545
author:
type: fixed
......@@ -4,7 +4,7 @@ module Gitlab
module Jira
class Middleware
def self.jira_dvcs_connector?(env)
env['HTTP_USER_AGENT']&.start_with?('JIRA DVCS Connector')
env['HTTP_USER_AGENT']&.downcase&.start_with?('jira dvcs connector')
end
def initialize(app)
......
......@@ -10,6 +10,10 @@ describe Gitlab::Jira::Middleware do
expect(described_class.jira_dvcs_connector?('HTTP_USER_AGENT' => jira_user_agent)).to eq(true)
end
it 'returns true if user agent starts with "Jira DVCS Connector"' do
expect(described_class.jira_dvcs_connector?('HTTP_USER_AGENT' => 'Jira DVCS Connector')).to eq(true)
end
it 'returns false when not DVCS connector' do
expect(described_class.jira_dvcs_connector?('HTTP_USER_AGENT' => 'pokemon')).to eq(false)
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