fix(api): fix an issue with optional numeric query parameter parsing

pull/2060/head
Anthony Lapenna 6 years ago
parent 4129550d44
commit 509e3fa795

@ -1,6 +1,7 @@
package stacks
import (
"log"
"net/http"
"strconv"
@ -22,6 +23,7 @@ func (handler *Handler) stackDelete(w http.ResponseWriter, r *http.Request) *htt
}
externalStack, _ := request.RetrieveBooleanQueryParameter(r, "external", true)
log.Printf("External stack value: %v", externalStack)
if externalStack {
return handler.deleteExternalStack(r, w, stackID)
}

@ -133,6 +133,9 @@ func RetrieveNumericQueryParameter(request *http.Request, name string, optional
if err != nil {
return 0, err
}
if queryParameter == "" && optional {
return 0, nil
}
return strconv.Atoi(queryParameter)
}

Loading…
Cancel
Save