Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
5b756e2f
Commit
5b756e2f
authored
Mar 22, 2017
by
Sander van Harmelen
Committed by
GitHub
Mar 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the WithContext func (#149)
parent
219e9b58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
gitlab.go
gitlab.go
+1
-1
gitlab_test.go
gitlab_test.go
+1
-1
No files found.
gitlab.go
View file @
5b756e2f
...
...
@@ -550,7 +550,7 @@ func WithSudo(uid interface{}) OptionFunc {
// WithContext runs the request with the provided context
func
WithContext
(
ctx
context
.
Context
)
OptionFunc
{
return
func
(
req
*
http
.
Request
)
error
{
req
=
req
.
WithContext
(
ctx
)
*
req
=
*
req
.
WithContext
(
ctx
)
return
nil
}
}
...
...
gitlab_test.go
View file @
5b756e2f
...
...
@@ -140,7 +140,7 @@ func TestCheckResponse(t *testing.T) {
}
func
TestRequestWithContext
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
(
)
ctx
:=
context
.
WithValue
(
context
.
Background
(),
interface
{}(
"myKey"
),
interface
{}(
"myValue"
)
)
req
,
err
:=
NewClient
(
nil
,
""
)
.
NewRequest
(
"GET"
,
"test"
,
nil
,
[]
OptionFunc
{
WithContext
(
ctx
)})
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to create request: %v"
,
err
)
...
...
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