fixed errcheck in test_serve_metrics_plugin (#29289)
Этот коммит содержится в:
@@ -120,7 +120,6 @@ issues:
|
|||||||
channels/app/platform/web_conn.go|\
|
channels/app/platform/web_conn.go|\
|
||||||
channels/app/platform/web_hub.go|\
|
channels/app/platform/web_hub.go|\
|
||||||
channels/app/platform/web_hub_test.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_api_tests/test_update_user_auth_plugin/main.go|\
|
||||||
channels/app/plugin_install.go|\
|
channels/app/plugin_install.go|\
|
||||||
channels/app/plugin_signature.go|\
|
channels/app/plugin_signature.go|\
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost/server/public/plugin"
|
"github.com/mattermost/mattermost/server/public/plugin"
|
||||||
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Plugin struct {
|
type Plugin struct {
|
||||||
@@ -15,11 +16,21 @@ type Plugin struct {
|
|||||||
|
|
||||||
func (p *Plugin) ServeMetrics(_ *plugin.Context, w http.ResponseWriter, r *http.Request) {
|
func (p *Plugin) ServeMetrics(_ *plugin.Context, w http.ResponseWriter, r *http.Request) {
|
||||||
if r.URL.Path == "/subpath" {
|
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
|
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() {
|
func main() {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user