Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Get snap name from request in a single line
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenwilkin committed Jul 5, 2016
1 parent eca8a49 commit ebe9c54
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions snappy/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ func (h *Handler) getAll(w http.ResponseWriter, r *http.Request) {
}

func (h *Handler) get(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["name"]
name := mux.Vars(r)["name"]

payload, err := h.packagePayload(name)
if err != nil {
Expand All @@ -104,17 +103,15 @@ func (h *Handler) get(w http.ResponseWriter, r *http.Request) {
}

func (h *Handler) add(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["name"]
name := mux.Vars(r)["name"]

err := h.installPackage(name)

h.snapOperationResponse(name, err, w)
}

func (h *Handler) remove(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["name"]
name := mux.Vars(r)["name"]

err := h.removePackage(name)

Expand Down

0 comments on commit ebe9c54

Please sign in to comment.