Commit a7da684a authored by James Addison's avatar James Addison
Browse files

Merge branch 'master' into collabora

parents 7b02d88a 0d075c32
Pipeline #28680 passed with stage
in 10 minutes and 29 seconds
......@@ -454,7 +454,7 @@ run-server: prepackaged-binaries validate-go-version start-docker ## Starts the
@echo Running mattermost for development
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) --disableconfigwatch 2>&1 | \
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) 2>&1 | \
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) logs --logrus $(RUN_IN_BACKGROUND)
debug-server: start-docker ## Compile and start server using delve.
......@@ -503,11 +503,11 @@ ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
wmic process where "Caption='go.exe' and CommandLine like '%go.exe run%'" call terminate
wmic process where "Caption='mattermost.exe' and CommandLine like '%go-build%'" call terminate
else
@for PID in $$(ps -ef | grep "[g]o run" | grep "disableconfigwatch" | awk '{ print $$2 }'); do \
@for PID in $$(ps -ef | grep "[g]o run" | awk '{ print $$2 }'); do \
echo stopping go $$PID; \
kill $$PID; \
done
@for PID in $$(ps -ef | grep "[g]o-build" | grep "disableconfigwatch" | awk '{ print $$2 }'); do \
@for PID in $$(ps -ef | grep "[g]o-build" | awk '{ print $$2 }'); do \
echo stopping mattermost $$PID; \
kill $$PID; \
done
......@@ -536,7 +536,7 @@ restart-client: | stop-client run-client ## Restarts the webapp.
run-job-server: ## Runs the background job server.
@echo Running job server for development
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) jobserver --disableconfigwatch &
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) jobserver &
config-ldap: ## Configures LDAP.
@echo Setting up configuration for local LDAP
......
......@@ -13,6 +13,7 @@ import (
"github.com/mattermost/mattermost-server/v6/audit"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (api *API) InitBot() {
......@@ -74,7 +75,9 @@ func createBot(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.AddMeta("bot", createdBot) // overwrite meta
w.WriteHeader(http.StatusCreated)
w.Write(createdBot.ToJson())
if err := json.NewEncoder(w).Encode(createdBot); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func patchBot(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -109,7 +112,9 @@ func patchBot(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.Success()
auditRec.AddMeta("bot", updatedBot)
w.Write(updatedBot.ToJson())
if err := json.NewEncoder(w).Encode(updatedBot); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func getBot(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -148,7 +153,9 @@ func getBot(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
w.Write(bot.ToJson())
if err := json.NewEncoder(w).Encode(bot); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func getBots(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -183,7 +190,9 @@ func getBots(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
w.Write(bots.ToJson())
if err := json.NewEncoder(w).Encode(bots); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func disableBot(c *Context, w http.ResponseWriter, _ *http.Request) {
......@@ -220,7 +229,9 @@ func updateBotActive(c *Context, w http.ResponseWriter, active bool) {
auditRec.Success()
auditRec.AddMeta("bot", bot)
w.Write(bot.ToJson())
if err := json.NewEncoder(w).Encode(bot); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func assignBot(c *Context, w http.ResponseWriter, _ *http.Request) {
......@@ -258,7 +269,9 @@ func assignBot(c *Context, w http.ResponseWriter, _ *http.Request) {
auditRec.Success()
auditRec.AddMeta("bot", bot)
w.Write(bot.ToJson())
if err := json.NewEncoder(w).Encode(bot); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func getBotIconImage(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -423,5 +436,7 @@ func convertBotToUser(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.Success()
auditRec.AddMeta("convertedTo", user)
w.Write([]byte(user.ToJson()))
if err := json.NewEncoder(w).Encode(user); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
This diff is collapsed.
......@@ -4,6 +4,7 @@
package api4
import (
"encoding/json"
"net/http"
"github.com/mattermost/mattermost-server/v6/audit"
......@@ -45,7 +46,8 @@ func createCategoryForTeamForUser(c *Context, w http.ResponseWriter, r *http.Req
auditRec := c.MakeAuditRecord("createCategoryForTeamForUser", audit.Fail)
defer c.LogAuditRec(auditRec)
categoryCreateRequest, err := model.SidebarCategoryFromJson(r.Body)
var categoryCreateRequest *model.SidebarCategoryWithChannels
err := json.NewDecoder(r.Body).Decode(&categoryCreateRequest)
if err != nil || c.Params.UserId != categoryCreateRequest.UserId || c.Params.TeamId != categoryCreateRequest.TeamId {
c.SetInvalidParam("category")
return
......@@ -153,7 +155,8 @@ func updateCategoriesForTeamForUser(c *Context, w http.ResponseWriter, r *http.R
auditRec := c.MakeAuditRecord("updateCategoriesForTeamForUser", audit.Fail)
defer c.LogAuditRec(auditRec)
categoriesUpdateRequest, err := model.SidebarCategoriesFromJson(r.Body)
var categoriesUpdateRequest []*model.SidebarCategoryWithChannels
err := json.NewDecoder(r.Body).Decode(&categoriesUpdateRequest)
if err != nil {
c.SetInvalidParam("category")
return
......@@ -241,7 +244,8 @@ func updateCategoryForTeamForUser(c *Context, w http.ResponseWriter, r *http.Req
auditRec := c.MakeAuditRecord("updateCategoryForTeamForUser", audit.Fail)
defer c.LogAuditRec(auditRec)
categoryUpdateRequest, err := model.SidebarCategoryFromJson(r.Body)
var categoryUpdateRequest *model.SidebarCategoryWithChannels
err := json.NewDecoder(r.Body).Decode(&categoryUpdateRequest)
if err != nil || categoryUpdateRequest.TeamId != c.Params.TeamId || categoryUpdateRequest.UserId != c.Params.UserId {
c.SetInvalidParam("category")
return
......
......@@ -4,11 +4,13 @@
package api4
import (
"encoding/json"
"net/http"
"github.com/mattermost/mattermost-server/v6/app"
"github.com/mattermost/mattermost-server/v6/audit"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (api *API) InitChannelLocal() {
......@@ -36,8 +38,9 @@ func (api *API) InitChannelLocal() {
}
func localCreateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
channel := model.ChannelFromJson(r.Body)
if channel == nil {
var channel *model.Channel
err := json.NewDecoder(r.Body).Decode(&channel)
if err != nil {
c.SetInvalidParam("channel")
return
}
......@@ -46,9 +49,9 @@ func localCreateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
defer c.LogAuditRec(auditRec)
auditRec.AddMeta("channel", channel)
sc, err := c.App.CreateChannel(c.AppContext, channel, false)
if err != nil {
c.Err = err
sc, appErr := c.App.CreateChannel(c.AppContext, channel, false)
if appErr != nil {
c.Err = appErr
return
}
......@@ -57,7 +60,9 @@ func localCreateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("name=" + channel.Name)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(sc.ToJson()))
if err := json.NewEncoder(w).Encode(sc); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localUpdateChannelPrivacy(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -99,7 +104,9 @@ func localUpdateChannelPrivacy(c *Context, w http.ResponseWriter, r *http.Reques
auditRec.Success()
c.LogAudit("name=" + updatedChannel.Name)
w.Write([]byte(updatedChannel.ToJson()))
if err := json.NewEncoder(w).Encode(updatedChannel); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localRestoreChannel(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -127,7 +134,9 @@ func localRestoreChannel(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.Success()
c.LogAudit("name=" + channel.Name)
w.Write([]byte(channel.ToJson()))
if err := json.NewEncoder(w).Encode(channel); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localAddChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -210,7 +219,9 @@ func localAddChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("name=" + channel.Name + " user_id=" + cm.UserId)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(cm.ToJson()))
if err := json.NewEncoder(w).Encode(cm); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localRemoveChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -263,15 +274,16 @@ func localPatchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
patch := model.ChannelPatchFromJson(r.Body)
if patch == nil {
var patch *model.ChannelPatch
err := json.NewDecoder(r.Body).Decode(&patch)
if err != nil {
c.SetInvalidParam("channel")
return
}
originalOldChannel, err := c.App.GetChannel(c.Params.ChannelId)
if err != nil {
c.Err = err
originalOldChannel, appErr := c.App.GetChannel(c.Params.ChannelId)
if appErr != nil {
c.Err = appErr
return
}
channel := originalOldChannel.DeepCopy()
......@@ -281,15 +293,15 @@ func localPatchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.AddMeta("channel", channel)
channel.Patch(patch)
rchannel, err := c.App.UpdateChannel(channel)
if err != nil {
c.Err = err
rchannel, appErr := c.App.UpdateChannel(channel)
if appErr != nil {
c.Err = appErr
return
}
err = c.App.FillInChannelProps(rchannel)
if err != nil {
c.Err = err
appErr = c.App.FillInChannelProps(rchannel)
if appErr != nil {
c.Err = appErr
return
}
......@@ -297,7 +309,9 @@ func localPatchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("")
auditRec.AddMeta("patch", rchannel)
w.Write([]byte(rchannel.ToJson()))
if err := json.NewEncoder(w).Encode(rchannel); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localMoveChannel(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -367,7 +381,9 @@ func localMoveChannel(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("channel=" + channel.Name)
c.LogAudit("team=" + team.Name)
w.Write([]byte(channel.ToJson()))
if err := json.NewEncoder(w).Encode(channel); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localDeleteChannel(c *Context, w http.ResponseWriter, r *http.Request) {
......
......@@ -4,12 +4,14 @@
package api4
import (
"encoding/json"
"net/http"
"strconv"
"strings"
"github.com/mattermost/mattermost-server/v6/audit"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (api *API) InitCommand() {
......@@ -56,7 +58,9 @@ func createCommand(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.AddMeta("command", rcmd)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(rcmd.ToJson()))
if err := json.NewEncoder(w).Encode(rcmd); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func updateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -111,7 +115,9 @@ func updateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.Success()
c.LogAudit("success")
w.Write([]byte(rcmd.ToJson()))
if err := json.NewEncoder(w).Encode(rcmd); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func moveCommand(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -255,7 +261,9 @@ func listCommands(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
w.Write([]byte(model.CommandListToJson(commands)))
if err := json.NewEncoder(w).Encode(commands); err != nil {
mlog.Warn("Error writing response", mlog.Err(err))
}
}
func getCommand(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -284,7 +292,9 @@ func getCommand(c *Context, w http.ResponseWriter, r *http.Request) {
c.SetCommandNotFoundError()
return
}
w.Write([]byte(cmd.ToJson()))
if err := json.NewEncoder(w).Encode(cmd); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -344,7 +354,9 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
}
auditRec.Success()
w.Write([]byte(response.ToJson()))
if err := json.NewEncoder(w).Encode(response); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func listAutocompleteCommands(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -364,7 +376,9 @@ func listAutocompleteCommands(c *Context, w http.ResponseWriter, r *http.Request
return
}
w.Write([]byte(model.CommandListToJson(commands)))
if err := json.NewEncoder(w).Encode(commands); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func listCommandAutocompleteSuggestions(c *Context, w http.ResponseWriter, r *http.Request) {
......
......@@ -4,10 +4,12 @@
package api4
import (
"encoding/json"
"net/http"
"github.com/mattermost/mattermost-server/v6/audit"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (api *API) InitCommandLocal() {
......@@ -42,5 +44,7 @@ func localCreateCommand(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.AddMeta("command", rcmd)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(rcmd.ToJson()))
if err := json.NewEncoder(w).Encode(rcmd); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
......@@ -4,6 +4,7 @@
package api4
import (
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
......@@ -14,6 +15,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func TestCreateCommand(t *testing.T) {
......@@ -621,7 +623,9 @@ func TestExecuteInvalidCommand(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
rc := &model.CommandResponse{}
w.Write([]byte(rc.ToJson()))
if err := json.NewEncoder(w).Encode(rc); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......@@ -699,7 +703,9 @@ func TestExecuteGetCommand(t *testing.T) {
require.Equal(t, "ourCommand", values.Get("cmd"))
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(expectedCommandResponse.ToJson()))
if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......@@ -757,7 +763,9 @@ func TestExecutePostCommand(t *testing.T) {
require.Equal(t, th.BasicTeam.Name, r.FormValue("team_domain"))
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(expectedCommandResponse.ToJson()))
if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......@@ -809,7 +817,9 @@ func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(expectedCommandResponse.ToJson()))
if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......@@ -858,7 +868,9 @@ func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(expectedCommandResponse.ToJson()))
if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......@@ -915,7 +927,9 @@ func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(expectedCommandResponse.ToJson()))
if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......@@ -977,7 +991,9 @@ func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
require.Equal(t, team2.Name, r.FormValue("team_domain"))
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(expectedCommandResponse.ToJson()))
if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}))
defer ts.Close()
......
......@@ -4,6 +4,7 @@
package api4
import (
"encoding/json"
"net/http"
"strconv"
......@@ -11,6 +12,7 @@ import (
"github.com/mattermost/mattermost-server/v6/audit"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func (api *API) InitCompliance() {
......@@ -49,7 +51,9 @@ func createComplianceReport(c *Context, w http.ResponseWriter, r *http.Request)
c.LogAudit("")
w.WriteHeader(http.StatusCreated)
w.Write([]byte(rjob.ToJson()))
if err := json.NewEncoder(w).Encode(rjob); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func getComplianceReports(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -68,7 +72,9 @@ func getComplianceReports(c *Context, w http.ResponseWriter, r *http.Request) {
}
auditRec.Success()
w.Write([]byte(crs.ToJson()))
if err := json.NewEncoder(w).Encode(crs); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func getComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -95,7 +101,9 @@ func getComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
auditRec.AddMeta("compliance_id", job.Id)
auditRec.AddMeta("compliance_desc", job.Desc)
w.Write([]byte(job.ToJson()))
if err := json.NewEncoder(w).Encode(job); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func downloadComplianceReport(c *Context, w http.ResponseWriter, r *http.Request) {
......
......@@ -4,6 +4,7 @@
package api4
import (
"encoding/json"
"fmt"
"net/http"
"reflect"
......@@ -69,8 +70,10 @@ func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
if c.App.Srv().License() != nil && *c.App.Srv().License().Features.Cloud {
w.Write([]byte(cfg.ToJsonFiltered(model.ConfigAccessTagType, model.ConfigAccessTagCloudRestrictable)))
} else {
w.Write([]byte(cfg.ToJson()))
return
}
if err := json.NewEncoder(w).Encode(cfg); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
......@@ -173,8 +176,11 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
if c.App.Srv().License() != nil && *c.App.Srv().License().Features.Cloud {
w.Write([]byte(cfg.ToJsonFiltered(model.ConfigAccessTagType, model.ConfigAccessTagCloudRestrictable)))
} else {
w.Write([]byte(cfg.ToJson()))
return
}
if err := json.NewEncoder(w).Encode(cfg); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
......@@ -291,8 +297,11 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
if c.App.Srv().License() != nil && *c.App.Srv().License().Features.Cloud {
w.Write([]byte(cfg.ToJsonFiltered(model.ConfigAccessTagType, model.ConfigAccessTagCloudRestrictable)))
} else {
w.Write([]byte(cfg.ToJson()))
return
}
if err := json.NewEncoder(w).Encode(cfg); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
......
......@@ -4,12 +4,14 @@
package api4
import (
"encoding/json"
"net/http"
"reflect"
"github.com/mattermost/mattermost-server/v6/audit"
"github.com/mattermost/mattermost-server/v6/config"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/utils"
)
......@@ -26,7 +28,9 @@ func localGetConfig(c *Context, w http.ResponseWriter, r *http.Request) {
cfg := c.App.GetSanitizedConfig()
auditRec.Success()
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Write([]byte(cfg.ToJson()))
if err := json.NewEncoder(w).Encode(cfg); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localUpdateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
......@@ -76,7 +80,9 @@ func localUpdateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("updateConfig")
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Write([]byte(newCfg.ToJson()))
if err := json.NewEncoder(w).Encode(newCfg); err != nil {
mlog.Warn("Error while writing response", mlog.Err(err))
}
}
func localPatchConfig(c *Context, w http.ResponseWriter, r *http.Request</