Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
35971860
Commit
35971860
authored
Dec 21, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure nil User-Agent doesn't break the CI API
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
09b622f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
changelogs/unreleased/25895-fix-headers-in-ci-api-helpers.yml
...gelogs/unreleased/25895-fix-headers-in-ci-api-helpers.yml
+4
-0
lib/ci/api/helpers.rb
lib/ci/api/helpers.rb
+1
-1
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+5
-0
No files found.
changelogs/unreleased/25895-fix-headers-in-ci-api-helpers.yml
0 → 100644
View file @
35971860
---
title
:
Ensure nil User-Agent doesn't break the CI API
merge_request
:
author
:
lib/ci/api/helpers.rb
View file @
35971860
...
@@ -60,7 +60,7 @@ module Ci
...
@@ -60,7 +60,7 @@ module Ci
end
end
def
build_not_found!
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!
no_content!
else
else
not_found!
not_found!
...
...
spec/requests/ci/api/builds_spec.rb
View file @
35971860
...
@@ -37,6 +37,11 @@ describe Ci::API::Builds do
...
@@ -37,6 +37,11 @@ describe Ci::API::Builds do
let
(
:user_agent
)
{
'Go-http-client/1.1'
}
let
(
:user_agent
)
{
'Go-http-client/1.1'
}
it
{
expect
(
response
).
to
have_http_status
(
404
)
}
it
{
expect
(
response
).
to
have_http_status
(
404
)
}
end
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
end
context
'when there is a pending build'
do
context
'when there is a pending build'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment