Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
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
iv
gitlab-workhorse
Commits
4704ce33
Commit
4704ce33
authored
May 25, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for presence of Gitlab-Workhorse headers
parent
504bd633
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
proxy_test.go
proxy_test.go
+12
-1
No files found.
proxy_test.go
View file @
4704ce33
...
...
@@ -8,6 +8,7 @@ import (
"net/http"
"net/http/httptest"
"regexp"
"strings"
"testing"
"time"
...
...
@@ -17,8 +18,10 @@ import (
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
const
testVersion
=
"123"
func
newProxy
(
url
string
,
rt
*
badgateway
.
RoundTripper
)
*
proxy
.
Proxy
{
return
proxy
.
NewProxy
(
helper
.
URLMustParse
(
url
),
"123"
,
rt
)
return
proxy
.
NewProxy
(
helper
.
URLMustParse
(
url
),
testVersion
,
rt
)
}
func
TestProxyRequest
(
t
*
testing
.
T
)
{
...
...
@@ -31,6 +34,14 @@ func TestProxyRequest(t *testing.T) {
t
.
Fatal
(
"Missing custom header"
)
}
if
h
:=
r
.
Header
.
Get
(
"Gitlab-Workhorse"
);
h
!=
testVersion
{
t
.
Fatalf
(
"Missing GitLab-Workhorse header: want %q, got %q"
,
testVersion
,
h
)
}
if
h
:=
r
.
Header
.
Get
(
"Gitlab-Worhorse-Proxy-Start"
);
!
strings
.
HasPrefix
(
h
,
"1"
)
{
t
.
Fatalf
(
"Expect Gitlab-Worhorse-Proxy-Start to start with 1, got %q"
,
h
)
}
var
body
bytes
.
Buffer
io
.
Copy
(
&
body
,
r
.
Body
)
if
body
.
String
()
!=
"REQUEST"
{
...
...
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