From 2e78393474db8cd8a012db7d4c691ae7e39d15ce Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Thu, 29 Feb 2024 21:15:32 +0900 Subject: [PATCH] Assign StatusBadRequest code for http bind error --- src/core/common/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/common/client.go b/src/core/common/client.go index 519e1532b..f8be2932c 100644 --- a/src/core/common/client.go +++ b/src/core/common/client.go @@ -232,7 +232,11 @@ func EndRequestWithLog(c echo.Context, reqID string, err error, responseData int details.Status = "Error" details.ErrorResponse = err.Error() RequestMap.Store(reqID, details) - return c.JSON(http.StatusInternalServerError, map[string]string{"message": err.Error()}) + if responseData == nil { + return c.JSON(http.StatusBadRequest, map[string]string{"message": err.Error()}) + } else { + return c.JSON(http.StatusInternalServerError, map[string]string{"message": err.Error()}) + } } details.Status = "Success"