Skip to content

Commit 53e102a

Browse files
committed
making config/data api backward compatible
1 parent 89656bf commit 53e102a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

api/restHandler/DeploymentConfigurationRestHandler.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,19 @@ func (handler *DeploymentConfigurationRestHandlerImpl) GetConfigData(w http.Resp
9191
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
9292
return
9393
}
94-
if r.ContentLength > 0 {
95-
valuesPayload := &bean.ValuesDto{}
96-
decoder := json.NewDecoder(r.Body)
97-
err = decoder.Decode(valuesPayload)
98-
if err != nil {
99-
handler.logger.Errorw("error in decoding the request payload", "err", err, "requestBody", r.Body)
100-
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
101-
return
94+
switch r.Method {
95+
case http.MethodPost:
96+
if r.ContentLength > 0 {
97+
valuesPayload := &bean.ValuesDto{}
98+
decoder := json.NewDecoder(r.Body)
99+
err = decoder.Decode(valuesPayload)
100+
if err != nil {
101+
handler.logger.Errorw("error in decoding the request payload", "err", err, "requestBody", r.Body)
102+
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
103+
return
104+
}
105+
configDataQueryParams.Values = valuesPayload.Values
102106
}
103-
configDataQueryParams.Values = valuesPayload.Values
104107
}
105108

106109
configDataQueryParams.UserId = userId

api/router/DeploymentConfigRouter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ func (router DeploymentConfigurationRouterImpl) initDeploymentConfigurationRoute
2626
Methods("GET")
2727
configRouter.Path("/data").
2828
HandlerFunc(router.deploymentGroupRestHandler.GetConfigData).
29-
Methods("POST")
29+
Methods("GET", "POST")
3030

3131
}

0 commit comments

Comments
 (0)