Ensure nil User-Agent doesn't break the CI API
Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
09b622f84c
commit
359718603e
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Ensure nil User-Agent doesn't break the CI API
|
||||
merge_request:
|
||||
author:
|
|
@ -60,7 +60,7 @@ module Ci
|
|||
end
|
||||
|
||||
def build_not_found!
|
||||
if headers['User-Agent'].match(/gitlab-ci-multi-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /)
|
||||
if headers['User-Agent'].to_s.match(/gitlab-ci-multi-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /)
|
||||
no_content!
|
||||
else
|
||||
not_found!
|
||||
|
|
|
@ -37,6 +37,11 @@ describe Ci::API::Builds do
|
|||
let(:user_agent) { 'Go-http-client/1.1' }
|
||||
it { expect(response).to have_http_status(404) }
|
||||
end
|
||||
|
||||
context "when runner doesn't have a User-Agent" do
|
||||
let(:user_agent) { nil }
|
||||
it { expect(response).to have_http_status(404) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a pending build' do
|
||||
|
|
Loading…
Reference in New Issue