fix(relay): 请求参数校验错误返回 HTTP 400 (#6774)

* fix(relay): return 400 for invalid request parameters
This commit is contained in:
Alex Xiang
2026-08-29 19:21:09 +08:00
committed by GitHub
parent eb48396d5f
commit 0f2a2075ab
+1 -1
View File
@@ -117,7 +117,7 @@ func Relay(c *gin.Context, relayFormat types.RelayFormat) {
if common.IsRequestBodyTooLargeError(err) || errors.Is(err, common.ErrRequestBodyTooLarge) { if common.IsRequestBodyTooLargeError(err) || errors.Is(err, common.ErrRequestBodyTooLarge) {
newAPIError = types.NewErrorWithStatusCode(err, types.ErrorCodeReadRequestBodyFailed, http.StatusRequestEntityTooLarge, types.ErrOptionWithSkipRetry()) newAPIError = types.NewErrorWithStatusCode(err, types.ErrorCodeReadRequestBodyFailed, http.StatusRequestEntityTooLarge, types.ErrOptionWithSkipRetry())
} else { } else {
newAPIError = types.NewError(err, types.ErrorCodeInvalidRequest) newAPIError = types.NewError(err, types.ErrorCodeInvalidRequest, types.ErrOptionWithStatusCode(http.StatusBadRequest), types.ErrOptionWithSkipRetry())
} }
return return
} }