Skip to content

Commit

Permalink
Fix delete
Browse files Browse the repository at this point in the history
  • Loading branch information
argonaut0 committed Sep 21, 2023
1 parent f098de9 commit 35823bc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ func (in *Instancer) handleInstanceCreate(c echo.Context) error {
}

func (in *Instancer) handleInstanceDelete(c echo.Context) error {
if !c.QueryParams().Has("chal") {
if !c.QueryParams().Has("id") {
return in.handleInstancePurge(c)
}
chalName := c.QueryParam("chal")
instanceID, err := strconv.ParseInt(c.QueryParam("id"), 10, 64)

if err != nil {
Expand All @@ -92,7 +91,7 @@ func (in *Instancer) handleInstanceDelete(c echo.Context) error {
}
c.Logger().Info("processed request to destroy an instance")

return c.JSON(http.StatusAccepted, InstancesResponse{"destroyed", chalName, instanceID, "TODO"})
return c.JSON(http.StatusAccepted, InstancesResponse{"destroyed", rec.Challenge, instanceID, "TODO"})
}

func (in *Instancer) handleInstancePurge(c echo.Context) error {
Expand Down

0 comments on commit 35823bc

Please sign in to comment.