Skip to content

Commit

Permalink
Adapt to new SetHeaders prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
dmage committed Oct 12, 2020
1 parent b097b99 commit bb8ea9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/dockerregistry/server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (ac *authChallenge) Error() string {
}

// SetHeaders sets the basic challenge header on the response.
func (ac *authChallenge) SetHeaders(w http.ResponseWriter) {
func (ac *authChallenge) SetHeaders(req *http.Request, w http.ResponseWriter) {
// WWW-Authenticate response challenge header.
// See https://tools.ietf.org/html/rfc6750#section-3
str := fmt.Sprintf("Basic realm=%s", ac.realm)
Expand All @@ -126,7 +126,7 @@ func (ac *tokenAuthChallenge) Error() string {
}

// SetHeaders sets the bearer challenge header on the response.
func (ac *tokenAuthChallenge) SetHeaders(w http.ResponseWriter) {
func (ac *tokenAuthChallenge) SetHeaders(req *http.Request, w http.ResponseWriter) {
// WWW-Authenticate response challenge header.
// See https://docs.docker.com/registry/spec/auth/token/#/how-to-authenticate and https://tools.ietf.org/html/rfc6750#section-3
str := fmt.Sprintf("Bearer realm=%q", ac.realm)
Expand Down
2 changes: 1 addition & 1 deletion pkg/dockerregistry/server/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func TestAccessController(t *testing.T) {
}
if isChallenge {
recorder := httptest.NewRecorder()
challengeErr.SetHeaders(recorder)
challengeErr.SetHeaders(req, recorder)
if !reflect.DeepEqual(recorder.HeaderMap, test.expectedHeaders) {
t.Fatalf("expected headers %#v, got %#v", test.expectedHeaders, recorder.HeaderMap)
}
Expand Down

0 comments on commit bb8ea9f

Please sign in to comment.