Add Go service/handler tests for API contract parity (#16905)

This commit is contained in:
euvre
2026-07-20 20:02:41 +08:00
committed by GitHub
parent 2f7c2eb53c
commit f45f03a016
46 changed files with 1553 additions and 214 deletions

View File

@@ -232,7 +232,7 @@ func (h *ChatHandler) DeleteChat(c *gin.Context) {
if err := h.chatService.DeleteChat(userID, chatID); err != nil {
if err.Error() == "no authorization" {
common.ResponseWithCodeData(c, common.CodeDataError, false, "No authorization")
common.ResponseWithCodeData(c, common.CodeAuthenticationError, false, "No authorization.")
return
}
common.ErrorWithCode(c, common.CodeDataError, err.Error())
@@ -330,7 +330,7 @@ func (h *ChatHandler) GetChat(c *gin.Context) {
errMsg := err.Error()
// Check if it's an authorization error
if errMsg == "no authorization" {
common.ResponseWithCodeData(c, common.CodeDataError, false, "No authorization")
common.ResponseWithCodeData(c, common.CodeAuthenticationError, false, "No authorization.")
return
}
// Not found error
@@ -413,7 +413,7 @@ func (h *ChatHandler) updateChatByMethod(c *gin.Context, patch bool) {
}
if err != nil {
if err.Error() == "no authorization" {
common.ResponseWithCodeData(c, common.CodeDataError, false, "No authorization")
common.ResponseWithCodeData(c, common.CodeAuthenticationError, false, "No authorization.")
return
}
common.ResponseWithCodeData(c, common.CodeDataError, nil, err.Error())