fixed errcheck in test_serve_metrics_plugin (#29289)

This commit is contained in:
pRAnaY
2024-11-15 21:02:17 +01:00
committed by GitHub
parent 324693c13a
commit 504934b612
2 changed files with 13 additions and 3 deletions
-1
View File
@@ -120,7 +120,6 @@ issues:
channels/app/platform/web_conn.go|\
channels/app/platform/web_hub.go|\
channels/app/platform/web_hub_test.go|\
channels/app/plugin_api_tests/manual.test_serve_metrics_plugin/main.go|\
channels/app/plugin_api_tests/test_update_user_auth_plugin/main.go|\
channels/app/plugin_install.go|\
channels/app/plugin_signature.go|\
@@ -7,6 +7,7 @@ import (
"net/http"
"github.com/mattermost/mattermost/server/public/plugin"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)
type Plugin struct {
@@ -15,11 +16,21 @@ type Plugin struct {
func (p *Plugin) ServeMetrics(_ *plugin.Context, w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/subpath" {
w.Write([]byte("METRICS SUBPATH"))
_, err := w.Write([]byte("METRICS SUBPATH"))
if err != nil {
mlog.Error("Failed to write response", mlog.Err(err))
w.WriteHeader(http.StatusInternalServerError)
return
}
return
}
w.Write([]byte("METRICS"))
_, err := w.Write([]byte("METRICS"))
if err != nil {
mlog.Error("Failed to write response", mlog.Err(err))
w.WriteHeader(http.StatusInternalServerError)
return
}
}
func main() {