Skip to content

Commit

Permalink
Some modifications to audit (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlayzer authored Dec 10, 2024
1 parent fe03c93 commit c8d6099
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/server/middleware/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package middleware
import (
"context"
"net/http"
"strings"

"github.com/gin-contrib/requestid"
"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -84,6 +85,15 @@ func (w *auditWriter) asyncAudit(c *gin.Context) {

// getAuditStatus returns the status of operation.
func getAuditStatus(c *gin.Context) model.AuditOperationStatus {
// Directly use the native structure of kubernetes for the request of /pixiu/proxy and do separate processing
if strings.Contains(c.Request.RequestURI, "/pixiu/proxy") {
if responseOK(c.Writer.Status()) {
return model.AuditOpSuccess
} else {
return model.AuditOpFail
}
}

respCode := httputils.GetResponseCode(c)
if respCode == 0 {
return model.AuditOpUnknown
Expand Down

0 comments on commit c8d6099

Please sign in to comment.