Added log to show which URL is blocked by CORS. (#26347)
--------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
71e26b8df2
Коммит
a040618485
@@ -32,7 +32,10 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
ws, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
c.Err = model.NewAppError("connect", "api.web_socket.connect.upgrade.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
params := map[string]any{
|
||||
"BlockedOrigin": r.Header.Get("Origin"),
|
||||
}
|
||||
c.Err = model.NewAppError("connect", "api.web_socket.connect.upgrade.app_error", params, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -465,5 +465,5 @@ func TestWebSocketUpgrade(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, resp.StatusCode, http.StatusBadRequest)
|
||||
require.NoError(t, th.TestLogger.Flush())
|
||||
testlib.AssertLog(t, buffer, mlog.LvlDebug.Name, "Failed to upgrade websocket connection.")
|
||||
testlib.AssertLog(t, buffer, mlog.LvlDebug.Name, "URL Blocked because of CORS. Url: ")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user