fix: change http server status_code

This commit is contained in:
oliver
2025-02-13 16:20:47 +08:00
parent 8b8cd03e85
commit 0527993dd9

View File

@@ -96,9 +96,15 @@ func Relay(c *gin.Context) {
// BUG: bizErr is in race condition
bizErr.Error.Message = helper.MessageWithRequestId(bizErr.Error.Message, requestId)
c.JSON(bizErr.StatusCode, gin.H{
"error": bizErr.Error,
})
if bizErr.StatusCode < 500 || bizErr.StatusCode >= 100 {
c.JSON(http.StatusInternalServerError, gin.H{
"error": bizErr.Error,
})
} else {
c.JSON(bizErr.StatusCode, gin.H{
"error": bizErr.Error,
})
}
}
}