1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00

Merge pull request #650 from HuKeping/tiny-refactor

Tiny refactor
This commit is contained in:
Riyaz Faizullabhoy
2016-03-30 09:12:53 -07:00

View File

@@ -64,8 +64,10 @@ func (root *rootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var authCtx context.Context
var err error
if authCtx, err = root.auth.Authorized(ctx, access...); err != nil {
if err, ok := err.(auth.Challenge); ok {
err.ServeHTTP(w, r)
if challenge, ok := err.(auth.Challenge); ok {
// Let the challenge write the response.
challenge.ServeHTTP(w, r)
w.WriteHeader(http.StatusUnauthorized)
return
}