diff --git a/client.go b/client.go index c65594c..5023c32 100644 --- a/client.go +++ b/client.go @@ -1478,7 +1478,6 @@ func (c *Client) WrapHttpHandler(handler ClientHttpHandler) http.Handler { var err error var start_time time.Time var time_taken time.Duration - var realm string // this deferred function is to overcome the recovering implemenation // from panic done in go's http server. in that implemenation, panic @@ -1500,6 +1499,8 @@ func (c *Client) WrapHttpHandler(handler ClientHttpHandler) http.Handler { if req.Method == http.MethodOptions { status_code = WriteEmptyRespHeader(w, http.StatusOK) } else { + var realm string + status_code, realm = handler.Authenticate(req) if status_code == http.StatusUnauthorized { if realm != "" { diff --git a/server.go b/server.go index 64c2ae3..8fbba03 100644 --- a/server.go +++ b/server.go @@ -1182,7 +1182,6 @@ func (s *Server) WrapHttpHandler(handler ServerHttpHandler) http.Handler { var err error var start_time time.Time var time_taken time.Duration - var realm string // this deferred function is to overcome the recovering implemenation // from panic done in go's http server. in that implemenation, panic @@ -1204,6 +1203,8 @@ func (s *Server) WrapHttpHandler(handler ServerHttpHandler) http.Handler { if req.Method == http.MethodOptions { status_code = WriteEmptyRespHeader(w, http.StatusOK) } else { + var realm string + status_code, realm = handler.Authenticate(req) if status_code == http.StatusUnauthorized { if realm != "" {