Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Make http.AuthMethod setAuth public. Fixes #1196 #1197

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions plumbing/transport/http/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (s *session) ApplyAuthToRequest(req *http.Request) {
return
}

s.auth.setAuth(req)
s.auth.SetAuth(req)
}

func (s *session) ModifyEndpointIfRedirect(res *http.Response) {
Expand Down Expand Up @@ -175,7 +175,7 @@ func (*session) Close() error {
// AuthMethod is concrete implementation of common.AuthMethod for HTTP services
type AuthMethod interface {
transport.AuthMethod
setAuth(r *http.Request)
SetAuth(r *http.Request)
}

func basicAuthFromEndpoint(ep *transport.Endpoint) *BasicAuth {
Expand All @@ -192,7 +192,7 @@ type BasicAuth struct {
Username, Password string
}

func (a *BasicAuth) setAuth(r *http.Request) {
func (a *BasicAuth) SetAuth(r *http.Request) {
if a == nil {
return
}
Expand Down Expand Up @@ -226,7 +226,7 @@ type TokenAuth struct {
Token string
}

func (a *TokenAuth) setAuth(r *http.Request) {
func (a *TokenAuth) SetAuth(r *http.Request) {
if a == nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion plumbing/transport/http/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (s *ClientSuite) TestNewTokenAuth(c *C) {
// Check header is set correctly
req, err := http.NewRequest("GET", "https://github.com/git-fixtures/basic", nil)
c.Assert(err, Equals, nil)
a.setAuth(req)
a.SetAuth(req)
c.Assert(req.Header.Get("Authorization"), Equals, "Bearer OAUTH-TOKEN-TEXT")
}

Expand Down