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:
Stephanie Hingtgen
2024-07-10 20:48:02 +02:00
committed by GitHub
co-authored by Jean-Philippe Quémémer
parent 936b3a7a5d
commit bb187ce4b1
4 changed files with 48 additions and 17 deletions
+5 -5
View File
@@ -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