From eb241b960f5f652a23c66ddce5027dcc2b27e673 Mon Sep 17 00:00:00 2001 From: Carl Bergquist Date: Mon, 29 Mar 2021 08:56:58 +0200 Subject: [PATCH] API: Datasource endpoint should return 400 bad request if id and orgId is invalid (#32392) * return 400 bad request if id and orgId is invalid Signed-off-by: bergquist Co-authored-by: Arve Knudsen --- pkg/api/datasources.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go index 970c3b2ced0..9a3afea8575 100644 --- a/pkg/api/datasources.go +++ b/pkg/api/datasources.go @@ -71,6 +71,9 @@ func GetDataSourceById(c *models.ReqContext) response.Response { if errors.Is(err, models.ErrDataSourceNotFound) { return response.Error(404, "Data source not found", nil) } + if errors.Is(err, models.ErrDataSourceIdentifierNotSet) { + return response.Error(400, "Datasource id is missing", nil) + } return response.Error(500, "Failed to query datasources", err) }