BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
04c6d102
Unverified
Commit
04c6d102
authored
Dec 04, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use RequestOptions in GCP Client user_agent_header
parent
50c8bd63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
client.rb
lib/google_api/cloud_platform/client.rb
+3
-1
client_spec.rb
spec/lib/google_api/cloud_platform/client_spec.rb
+7
-2
No files found.
lib/google_api/cloud_platform/client.rb
View file @
04c6d102
...
...
@@ -84,7 +84,9 @@ module GoogleApi
end
def
user_agent_header
{
'User-Agent'
:
"GitLab/
#{
Gitlab
::
VERSION
.
match
(
'(\d+\.\d+)'
).
captures
.
first
}
(GPN:GitLab;)"
}
options
=
Google
::
Apis
::
RequestOptions
.
new
options
.
header
=
{
'User-Agent'
:
"GitLab/
#{
Gitlab
::
VERSION
.
match
(
'(\d+\.\d+)'
).
captures
.
first
}
(GPN:GitLab;)"
}
options
end
end
end
...
...
spec/lib/google_api/cloud_platform/client_spec.rb
View file @
04c6d102
...
...
@@ -129,9 +129,14 @@ describe GoogleApi::CloudPlatform::Client do
describe
'#user_agent_header'
do
subject
{
client
.
instance_eval
{
user_agent_header
}
}
it
'returns the correct major and minor GitLab version '
do
it
'returns a RequestOptions object'
do
expect
(
subject
).
to
be_instance_of
(
Google
::
Apis
::
RequestOptions
)
end
it
'has the correct GitLab version in User-Agent header'
do
stub_const
(
'Gitlab::VERSION'
,
'10.3.0-pre'
)
expect
(
subject
).
to
eq
({
'User-Agent'
:
'GitLab/10.3 (GPN:GitLab;)'
})
expect
(
subject
.
header
).
to
eq
({
'User-Agent'
:
'GitLab/10.3 (GPN:GitLab;)'
})
end
end
end
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