fixed errcheck in test_serve_metrics_plugin (#29289)

Этот коммит содержится в:
pRAnaY
2024-11-16 01:32:17 +05:30
коммит произвёл GitHub
родитель 324693c13a
Коммит 504934b612
2 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@@ -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() {