ds-querier: return 400 when no code is present (#105633)
This commit is contained in:
@@ -31,7 +31,7 @@ type QueryDataResponse struct {
|
||||
// GetResponseCode return the right status code for the response by checking the responses.
|
||||
func GetResponseCode(rsp *backend.QueryDataResponse) int {
|
||||
if rsp == nil {
|
||||
return http.StatusTeapot // rsp is nil, so we return a teapot
|
||||
return http.StatusBadRequest // rsp is nil, so we return a 400
|
||||
}
|
||||
for _, res := range rsp.Responses {
|
||||
if res.Error != nil && res.Status != 0 {
|
||||
@@ -39,7 +39,7 @@ func GetResponseCode(rsp *backend.QueryDataResponse) int {
|
||||
}
|
||||
|
||||
if res.Error != nil {
|
||||
return http.StatusTeapot // Status is nil but we have an error, so we return a teapot
|
||||
return http.StatusBadRequest // Status is nil but we have an error, so we return a 400
|
||||
}
|
||||
}
|
||||
return http.StatusOK
|
||||
|
||||
Reference in New Issue
Block a user