K8s: Match status codes from single tenant (#90153)
Co-authored-by: Jean-Philippe Quémémer <jeanphilippe.quemener@grafana.com>
This commit is contained in:
co-authored by
Jean-Philippe Quémémer
parent
936b3a7a5d
commit
bb187ce4b1
@@ -27,14 +27,14 @@ type QueryDataResponse struct {
|
||||
backend.QueryDataResponse `json:",inline"`
|
||||
}
|
||||
|
||||
// If errors exist, return multi-status
|
||||
// GetResponseCode return the right status code for the response by checking the responses.
|
||||
func GetResponseCode(rsp *backend.QueryDataResponse) int {
|
||||
if rsp == nil {
|
||||
return http.StatusInternalServerError
|
||||
return http.StatusBadRequest
|
||||
}
|
||||
for _, v := range rsp.Responses {
|
||||
if v.Error != nil {
|
||||
return http.StatusMultiStatus
|
||||
for _, res := range rsp.Responses {
|
||||
if res.Error != nil {
|
||||
return http.StatusBadRequest
|
||||
}
|
||||
}
|
||||
return http.StatusOK
|
||||
|
||||
Reference in New Issue
Block a user