mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:42:51 +08:00
Chore: Refactor api handlers to use web.Bind (#42199)
* Chore: Refactor api handlers to use web.Bind * fix comments * fix comment * trying to fix most of the tests and force routing.Wrap type check * fix library panels tests * fix frontend logging tests * allow passing nil as a response to skip writing * return nil instead of the response * rewrite login handler function types * remove handlerFuncCtx * make linter happy * remove old bindings from the libraryelements * restore comments
This commit is contained in:
@ -3,7 +3,6 @@ package api
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
@ -84,9 +83,10 @@ func logSentryEventScenario(t *testing.T, desc string, event frontendlogging.Fro
|
||||
|
||||
loggingHandler := NewFrontendLogMessageHandler(sourceMapStore)
|
||||
|
||||
handler := routing.Wrap(func(w http.ResponseWriter, c *models.ReqContext) response.Response {
|
||||
handler := routing.Wrap(func(c *models.ReqContext) response.Response {
|
||||
sc.context = c
|
||||
return loggingHandler(c, event)
|
||||
c.Req.Body = mockRequestBody(event)
|
||||
return loggingHandler(c)
|
||||
})
|
||||
|
||||
sc.m.Post(sc.url, handler)
|
||||
|
Reference in New Issue
Block a user