优化结构

This commit is contained in:
Yvan
2026-08-28 15:37:40 +08:00
parent a4ed3a02df
commit 9b1daaf3f6
17 changed files with 100 additions and 64 deletions
+5 -4
View File
@@ -73,7 +73,9 @@ func OperationAudit(runtime *config.Store, recorder *systemservice.AuditRecorder
requestID, _ := c.Get("request_id")
status := c.Writer.Status()
responseBody := ""
if value, ok := c.Get(ctxRespBufferKey); ok {
if value, ok := c.Get(ctxRespTextKey); ok {
responseBody = stringValue(value)
} else if value, ok := c.Get(ctxRespBufferKey); ok {
if body, bok := value.(*bytes.Buffer); bok {
responseBody = redactJSON(body.Bytes(), c.Writer.Header().Get("Content-Type"), maxBytes)
}
@@ -91,10 +93,9 @@ func OperationAudit(runtime *config.Store, recorder *systemservice.AuditRecorder
// second time.
operationBody = stringValue(value)
capturedBody = true
} else {
operationBody = operationRequestBody(requestBody, c.GetHeader("Content-Type"), maxBytes)
}
} else {
}
if !capturedBody {
operationBody = operationRequestBody(requestBody, c.GetHeader("Content-Type"), maxBytes)
}
if !capturedBody && routecatalog.BodyPolicyFor(c.Request.Method, path) == routecatalog.BodyPolicyPaymentConfig {