[MM-61517] Fix errcheck issues in channels/app/plugin_api_tests/manual.test_http_hijack_plugin (#29190)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
pRAnaY
2024-11-15 01:17:19 +05:30
коммит произвёл GitHub
родитель 4620ab6ad3
Коммит 7403d29634
2 изменённых файлов: 13 добавлений и 3 удалений

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

@@ -122,7 +122,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_http_hijack_plugin/main.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|\

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

@@ -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 {
@@ -26,8 +27,18 @@ func (p *Plugin) ServeHTTP(_ *plugin.Context, w http.ResponseWriter, _ *http.Req
return
}
conn.Write([]byte("HTTP/1.1 200\n\nOK"))
conn.Close()
_, err = conn.Write([]byte("HTTP/1.1 200\n\nOK"))
if err != nil {
mlog.Error("Failed to write to connection", mlog.Err(err))
w.WriteHeader(http.StatusInternalServerError)
return
}
err = conn.Close()
if err != nil {
mlog.Error("Failed to close connection", mlog.Err(err))
w.WriteHeader(http.StatusInternalServerError)
return
}
}
func main() {