mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
* use new layered architecture in get dimension keys request * go lint fixes * pr feedback * more pr feedback * remove not used code * refactor route middleware * change signature * add integration tests for the dimension keys route * use request suffix instead of query * use typed args also in frontend * remove unused import * harmonize naming * fix merge conflict
23 lines
503 B
Go
23 lines
503 B
Go
package routes
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/cloudwatch/models"
|
|
)
|
|
|
|
func respondWithError(rw http.ResponseWriter, httpError *models.HttpError) {
|
|
response, err := json.Marshal(httpError)
|
|
if err != nil {
|
|
rw.WriteHeader(http.StatusInternalServerError)
|
|
return
|
|
}
|
|
rw.Header().Set("Content-Type", "application/json")
|
|
rw.WriteHeader(httpError.StatusCode)
|
|
_, err = rw.Write(response)
|
|
if err != nil {
|
|
rw.WriteHeader(http.StatusInternalServerError)
|
|
}
|
|
}
|