Skip to content

Commit b294aa1

Browse files
authored
Merge pull request src-d#1197 from hypnoce/master
Make http.AuthMethod setAuth public. Fixes src-d#1196
2 parents 1edb992 + 361f21d commit b294aa1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

plumbing/transport/http/common.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (s *session) ApplyAuthToRequest(req *http.Request) {
139139
return
140140
}
141141

142-
s.auth.setAuth(req)
142+
s.auth.SetAuth(req)
143143
}
144144

145145
func (s *session) ModifyEndpointIfRedirect(res *http.Response) {
@@ -175,7 +175,7 @@ func (*session) Close() error {
175175
// AuthMethod is concrete implementation of common.AuthMethod for HTTP services
176176
type AuthMethod interface {
177177
transport.AuthMethod
178-
setAuth(r *http.Request)
178+
SetAuth(r *http.Request)
179179
}
180180

181181
func basicAuthFromEndpoint(ep *transport.Endpoint) *BasicAuth {
@@ -192,7 +192,7 @@ type BasicAuth struct {
192192
Username, Password string
193193
}
194194

195-
func (a *BasicAuth) setAuth(r *http.Request) {
195+
func (a *BasicAuth) SetAuth(r *http.Request) {
196196
if a == nil {
197197
return
198198
}
@@ -226,7 +226,7 @@ type TokenAuth struct {
226226
Token string
227227
}
228228

229-
func (a *TokenAuth) setAuth(r *http.Request) {
229+
func (a *TokenAuth) SetAuth(r *http.Request) {
230230
if a == nil {
231231
return
232232
}

plumbing/transport/http/common_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (s *ClientSuite) TestNewTokenAuth(c *C) {
6464
// Check header is set correctly
6565
req, err := http.NewRequest("GET", "https://github.com/git-fixtures/basic", nil)
6666
c.Assert(err, Equals, nil)
67-
a.setAuth(req)
67+
a.SetAuth(req)
6868
c.Assert(req.Header.Get("Authorization"), Equals, "Bearer OAUTH-TOKEN-TEXT")
6969
}
7070

0 commit comments

Comments
 (0)