Correlations: Add UpdateCorrelation HTTP API (#52444) (#53224)

* Correlations: add UpdateCorrelation HTTP API

* handle correlation not found

* add tests

* fix lint errors

* add bad request to API spec

* change casing

* fix casing in docs

* fix tests

* update spec

(cherry picked from commit 09c4dbdb9f)

Co-authored-by: Giordano Ricci <me@giordanoricci.com>
This commit is contained in:
Grot (@grafanabot)
2022-08-03 09:35:17 -04:00
committed by GitHub
co-authored by Giordano Ricci
parent 6fe808734b
commit 83e062f4c8
9 changed files with 738 additions and 1 deletions
+19
View File
@@ -64,6 +64,25 @@ func (c TestContext) Post(params PostParams) *http.Response {
return resp
}
type PatchParams struct {
url string
body string
user User
}
func (c TestContext) Patch(params PatchParams) *http.Response {
c.t.Helper()
req, err := http.NewRequest(http.MethodPatch, c.getURL(params.url, params.user), bytes.NewBuffer([]byte(params.body)))
req.Header.Set("Content-Type", "application/json")
require.NoError(c.t, err)
resp, err := http.DefaultClient.Do(req)
require.NoError(c.t, err)
require.NoError(c.t, err)
return resp
}
type DeleteParams struct {
url string
user User