[MM-45990] log JSON parsing errors in API4 (#20724)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
04cd6d35e9
Коммит
832736da37
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v6/app"
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock"
|
||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||
"github.com/mattermost/mattermost-server/v6/store/storetest/mocks"
|
||||
"github.com/mattermost/mattermost-server/v6/utils"
|
||||
"github.com/mattermost/mattermost-server/v6/utils/testutils"
|
||||
@@ -306,7 +307,10 @@ func testCreatePostWithOutgoingHook(
|
||||
if requestContentType == "application/json" {
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
o := &model.OutgoingWebhookPayload{}
|
||||
decoder.Decode(&o)
|
||||
err := decoder.Decode(&o)
|
||||
if err != nil {
|
||||
th.TestLogger.Warn("Error decoding body", mlog.Err(err))
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expectedPayload, o) {
|
||||
t.Logf("JSON payload is %+v, should be %+v", o, expectedPayload)
|
||||
@@ -924,7 +928,7 @@ func TestPatchPost(t *testing.T) {
|
||||
|
||||
t.Run("invalid requests", func(t *testing.T) {
|
||||
r, err := client.DoAPIPut("/posts/"+post.Id+"/patch", "garbage")
|
||||
require.EqualError(t, err, ": Invalid or missing post in request body., ")
|
||||
require.EqualError(t, err, ": Invalid or missing post in request body.")
|
||||
require.Equal(t, http.StatusBadRequest, r.StatusCode, "wrong status code")
|
||||
|
||||
patch := &model.PostPatch{}
|
||||
|
||||
Ссылка в новой задаче
Block a user