Skip to content

Commit 21b3d3b

Browse files
committed
fix: Requestbody database compatibility issue
1 parent 25c0d4b commit 21b3d3b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

internal/models/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ type RequestLog struct {
111111
RequestType string `gorm:"type:varchar(20);not null;default:'final';index" json:"request_type"`
112112
UpstreamAddr string `gorm:"type:varchar(500)" json:"upstream_addr"`
113113
IsStream bool `gorm:"not null" json:"is_stream"`
114-
RequestBody string `gorm:"type:longtext" json:"request_body"`
114+
RequestBody string `gorm:"type:text" json:"request_body"`
115115
}
116116

117117
// StatCard 用于仪表盘的单个统计卡片数据

internal/proxy/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (ps *ProxyServer) logRequest(
257257
var requestBodyToLog, userAgent string
258258

259259
if group.EffectiveConfig.EnableRequestBodyLogging {
260-
requestBodyToLog = string(bodyBytes)
260+
requestBodyToLog = utils.TruncateString(string(bodyBytes), 65000)
261261
userAgent = c.Request.UserAgent()
262262
}
263263

0 commit comments

Comments
 (0)