Grafana: Replace magic number with a constant variable in response status (#80132)

* Chore: Replace response status with const var

* Apply suggestions from code review

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Add net/http import

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
김은빈
2024-02-28 01:39:51 +09:00
committed by GitHub
parent a7fbe3c6dc
commit 96dfb385ca
36 changed files with 260 additions and 255 deletions

View File

@@ -604,11 +604,11 @@ func exportHcl(download bool, body definitions.AlertingFileExport) response.Resp
return nil
}
if err := convertToResources(); err != nil {
return response.Error(500, "failed to convert to HCL resources", err)
return response.Error(http.StatusInternalServerError, "failed to convert to HCL resources", err)
}
hclBody, err := hcl.Encode(resources...)
if err != nil {
return response.Error(500, "body hcl encode", err)
return response.Error(http.StatusInternalServerError, "body hcl encode", err)
}
resp := response.Respond(http.StatusOK, hclBody)
if download {