tianxiaoliang commented on a change in pull request #129: wip: refactor apis
URL: https://github.com/apache/servicecomb-kie/pull/129#discussion_r398575921
 
 

 ##########
 File path: server/resource/v1/kv_resource.go
 ##########
 @@ -35,26 +36,76 @@ import (
 type KVResource struct {
 }
 
+//Put create or update kv
+func (r *KVResource) Post(context *restful.Context) {
+       var err error
+       project := context.ReadPathParameter(PathParameterProject)
+       kvDoc := new(model.KVDoc)
+       if err = readRequest(context, kvDoc); err != nil {
+               WriteErrResponse(context, http.StatusBadRequest, err.Error(), 
common.ContentTypeText)
+               return
+       }
+       if kvDoc.Key == "" {
+               WriteErrResponse(context, http.StatusBadRequest, 
common.MsgKeyMustNotBeEmpty, common.ContentTypeText)
+               return
+       }
+       domain := ReadDomain(context)
+       kvDoc.Domain = domain.(string)
+       kvDoc.Project = project
+       _, err = checkStatus(kvDoc.Status)
+       if err != nil {
+               WriteErrResponse(context, http.StatusInternalServerError, 
err.Error(), common.ContentTypeText)
+               return
+       }
+       kv, err := service.KVService.Create(context.Ctx, kvDoc)
+       if err != nil {
+               openlogging.Error(fmt.Sprintf("post [%v] err:%s", kvDoc, 
err.Error()))
 
 Review comment:
   domain 信息泄露了

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to