Skip to content

Commit

Permalink
... even better naming for function ...
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed Oct 18, 2017
1 parent 3fb2d17 commit e255763
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type TokenResponse interface {
Method() string
Token() string
ExpiresIn() int
Header() string
AuthHeader() string
}

func parseAuthHeader(headers http.Header) (string, string, error) {
Expand Down
4 changes: 2 additions & 2 deletions auth/basic/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func (tr TokenResponse) ExpiresIn() int {
return 0
}

// Header returns contents of the Authorization HTTP header
func (tr TokenResponse) Header() string {
// AuthHeader returns contents of the Authorization HTTP header
func (tr TokenResponse) AuthHeader() string {
return tr.Method() + " " + tr.Token()
}

Expand Down
4 changes: 2 additions & 2 deletions auth/bearer/bearer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func (tr TokenResponse) ExpiresIn() int {
return tr.E
}

// Header returns contents of the Authorization HTTP header
func (tr TokenResponse) Header() string {
// AuthHeader returns contents of the Authorization HTTP header
func (tr TokenResponse) AuthHeader() string {
return tr.Method() + " " + tr.Token()
}

Expand Down
4 changes: 2 additions & 2 deletions auth/none/none.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func (tr TokenResponse) ExpiresIn() int {
return 0
}

// Header returns contents of the Authorization HTTP header
func (tr TokenResponse) Header() string {
// AuthHeader returns contents of the Authorization HTTP header
func (tr TokenResponse) AuthHeader() string {
return tr.Method() + " " + tr.Token()
}

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func main() {
suicide(err, true)
}

remoteTags, err := remote.FetchTags(registry, repoPath, tr.Header(), concurrentRequests)
remoteTags, err := remote.FetchTags(registry, repoPath, tr.AuthHeader(), concurrentRequests)
if err != nil {
suicide(err, true)
}
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestDockerHubWithPublicRepo(t *testing.T) {
t.Fatalf("Failed to get DockerHub public repo token: %s", err.Error())
}

tags, err := remote.FetchTags(dockerHub, repo, tr.Header(), 128)
tags, err := remote.FetchTags(dockerHub, repo, tr.AuthHeader(), 128)
if err != nil {
t.Fatalf("Failed to list DockerHub public repo (%s) tags: %s", repo, err.Error())
}
Expand Down Expand Up @@ -60,7 +60,7 @@ func TestDockerHubWithPrivateRepo(t *testing.T) {
t.Fatalf("Failed to get DockerHub private repo token: %s", err.Error())
}

tags, err := remote.FetchTags(dockerHub, repo, tr.Header(), 128)
tags, err := remote.FetchTags(dockerHub, repo, tr.AuthHeader(), 128)
if err != nil {
t.Fatalf("Failed to list DockerHub private repo (%s) tags: %s", repo, err.Error())
}
Expand Down

0 comments on commit e255763

Please sign in to comment.