Explorar o código

make sure setting code happen before callback in rest (#936)

Kevin Wan %!s(int64=3) %!d(string=hai) anos
pai
achega
9672298fa8
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      rest/handler/authhandler.go

+ 3 - 2
rest/handler/authhandler.go

@@ -112,11 +112,12 @@ func unauthorized(w http.ResponseWriter, r *http.Request, err error, callback Un
 	} else {
 		detailAuthLog(r, noDetailReason)
 	}
+
+	writer.WriteHeader(http.StatusUnauthorized)
+
 	if callback != nil {
 		callback(writer, r, err)
 	}
-
-	writer.WriteHeader(http.StatusUnauthorized)
 }
 
 type guardedResponseWriter struct {