Commit 0f2a2075 by Alex Xiang Committed by GitHub

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

* fix(relay): return 400 for invalid request parameters
parent eb48396d
......@@ -117,7 +117,7 @@ func Relay(c *gin.Context, relayFormat types.RelayFormat) {
if common.IsRequestBodyTooLargeError(err) || errors.Is(err, common.ErrRequestBodyTooLarge) {
newAPIError = types.NewErrorWithStatusCode(err, types.ErrorCodeReadRequestBodyFailed, http.StatusRequestEntityTooLarge, types.ErrOptionWithSkipRetry())
} else {
newAPIError = types.NewError(err, types.ErrorCodeInvalidRequest)
newAPIError = types.NewError(err, types.ErrorCodeInvalidRequest, types.ErrOptionWithStatusCode(http.StatusBadRequest), types.ErrOptionWithSkipRetry())
}
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment