MM-46874: Change to 400 for failed to upgrade ws (#21492)
https://mattermost.atlassian.net/browse/MM-46874 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0fc1655cfc
Коммит
0323e40d3c
@@ -15,6 +15,8 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||
"github.com/mattermost/mattermost-server/v6/testlib"
|
||||
)
|
||||
|
||||
func TestWebSocketTrailingSlash(t *testing.T) {
|
||||
@@ -417,3 +419,15 @@ func TestWebSocketStatuses(t *testing.T) {
|
||||
|
||||
WebSocketClient.Close()
|
||||
}
|
||||
|
||||
func TestWebSocketUpgrade(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
url := fmt.Sprintf("http://localhost:%v", th.App.Srv().ListenAddr.Port) + model.APIURLSuffix + "/websocket"
|
||||
resp, err := http.Get(url)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.StatusCode, http.StatusBadRequest)
|
||||
require.NoError(t, th.TestLogger.Flush())
|
||||
testlib.AssertLog(t, th.LogBuffer, mlog.LvlDebug.Name, "Failed to upgrade websocket connection.")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user