You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/01/18 14:15:07 UTC

[GitHub] [apisix-dashboard] ShiningRush commented on a change in pull request #1322: feat: Add returning value for HTTP PUT and PATCH methods

ShiningRush commented on a change in pull request #1322:
URL: https://github.com/apache/apisix-dashboard/pull/1322#discussion_r559595231



##########
File path: api/internal/handler/consumer/consumer.go
##########
@@ -147,11 +147,12 @@ func (h *Handler) Set(c droplet.Context) (interface{}, error) {
 	input.Consumer.ID = input.Consumer.Username
 	ensurePluginsDefValue(input.Plugins)
 
-	if err := h.consumerStore.Update(c.Context(), &input.Consumer, true); err != nil {
+	ret, err := h.consumerStore.Update(c.Context(), &input.Consumer, true)
+	if err != nil {
 		return handler.SpecCodeResponse(err), err
 	}
 
-	return nil, nil
+	return ret, nil

Review comment:
       We can directly return `&input.Consumer`, because store is just return the pointer of it.
   So that we can avoid to return object in `Store`, keep one way to get changes would be better.




----------------------------------------------------------------
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:
users@infra.apache.org