mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 09:53:29 +08:00
Add Go service/handler tests for API contract parity (#16905)
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user