tokers commented on a change in pull request #868: URL: https://github.com/apache/apisix-dashboard/pull/868#discussion_r530990653
########## File path: api/internal/handler/consumer/consumer.go ########## @@ -97,35 +95,13 @@ func (h *Handler) List(c droplet.Context) (interface{}, error) { return ret, nil } -func (h *Handler) Create(c droplet.Context) (interface{}, error) { - input := c.Input().(*entity.Consumer) - if input.ID != "" && input.ID != input.Username { - return &data.SpecCodeResponse{StatusCode: http.StatusBadRequest}, - fmt.Errorf("consumer's id and username must be a same value") - } - input.ID = input.Username - - if _, ok := input.Plugins["jwt-auth"]; ok { - jwt := input.Plugins["jwt-auth"].(map[string]interface{}) - jwt["exp"] = 86400 - - input.Plugins["jwt-auth"] = jwt - } - - if err := h.consumerStore.Create(c.Context(), input); err != nil { - return handler.SpecCodeResponse(err), err - } - - return nil, nil -} - -type UpdateInput struct { +type SetInput struct { Username string `auto_read:"username,path"` entity.Consumer Review comment: Embed members should be put at the top. ########## File path: api/test/e2e/base.go ########## @@ -32,6 +33,11 @@ import ( var token string +var MExpect *httpexpect.Expect Review comment: Use var ( ...... ) ---------------------------------------------------------------- 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: us...@infra.apache.org