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
1
Merge Requests
1
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
nexedi
gitlab-workhorse
Commits
ae386eef
Commit
ae386eef
authored
Jul 11, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use URL-safe base64 in mock senddata headers
parent
aa12fe44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
main_test.go
main_test.go
+4
-4
No files found.
main_test.go
View file @
ae386eef
...
...
@@ -584,7 +584,7 @@ func TestGetGitBlob(t *testing.T) {
headerKey
:=
http
.
CanonicalHeaderKey
(
"Gitlab-Workhorse-Send-Data"
)
ts
:=
testhelper
.
TestServerWithHandler
(
regexp
.
MustCompile
(
`.`
),
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
responseJSON
:=
fmt
.
Sprintf
(
`{"RepoPath":"%s","BlobId":"%s"}`
,
path
.
Join
(
testRepoRoot
,
testRepo
),
blobId
)
encodedJSON
:=
base64
.
Std
Encoding
.
EncodeToString
([]
byte
(
responseJSON
))
encodedJSON
:=
base64
.
URL
Encoding
.
EncodeToString
([]
byte
(
responseJSON
))
w
.
Header
()
.
Set
(
headerKey
,
"git-blob:"
+
encodedJSON
)
if
_
,
err
:=
fmt
.
Fprintf
(
w
,
"GNU General Public License"
);
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -628,7 +628,7 @@ func TestGetGitDiff(t *testing.T) {
ts
:=
testhelper
.
TestServerWithHandler
(
regexp
.
MustCompile
(
`.`
),
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
responseJSON
:=
fmt
.
Sprintf
(
`{"RepoPath":"%s","ShaFrom":"%s","ShaTo":"%s"}`
,
path
.
Join
(
testRepoRoot
,
testRepo
),
fromSha
,
toSha
)
encodedJSON
:=
base64
.
Std
Encoding
.
EncodeToString
([]
byte
(
responseJSON
))
encodedJSON
:=
base64
.
URL
Encoding
.
EncodeToString
([]
byte
(
responseJSON
))
w
.
Header
()
.
Set
(
headerKey
,
"git-diff:"
+
encodedJSON
)
return
})
...
...
@@ -672,7 +672,7 @@ func TestGetGitPatch(t *testing.T) {
ts
:=
testhelper
.
TestServerWithHandler
(
regexp
.
MustCompile
(
`.`
),
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
responseJSON
:=
fmt
.
Sprintf
(
`{"RepoPath":"%s","ShaFrom":"%s","ShaTo":"%s"}`
,
path
.
Join
(
testRepoRoot
,
testRepo
),
fromSha
,
toSha
)
encodedJSON
:=
base64
.
Std
Encoding
.
EncodeToString
([]
byte
(
responseJSON
))
encodedJSON
:=
base64
.
URL
Encoding
.
EncodeToString
([]
byte
(
responseJSON
))
w
.
Header
()
.
Set
(
headerKey
,
"git-format-patch:"
+
encodedJSON
)
return
})
...
...
@@ -790,7 +790,7 @@ func archiveOKServer(t *testing.T, archiveName string) *httptest.Server {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
encodedJSON
:=
base64
.
Std
Encoding
.
EncodeToString
(
jsonData
)
encodedJSON
:=
base64
.
URL
Encoding
.
EncodeToString
(
jsonData
)
w
.
Header
()
.
Set
(
"Gitlab-Workhorse-Send-Data"
,
"git-archive:"
+
encodedJSON
)
})
}
...
...
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