Commit 2cdb34fd authored by jackgr's avatar jackgr

Clean up registry types.

parent 440af2fa
...@@ -166,6 +166,10 @@ func execute() { ...@@ -166,6 +166,10 @@ func execute() {
switch args[0] { switch args[0] {
case "templates": case "templates":
path := fmt.Sprintf("registries/%s/types", *templateRegistry) path := fmt.Sprintf("registries/%s/types", *templateRegistry)
if *regexString != "" {
path += fmt.Sprintf("?%s", url.QueryEscape(*regexString))
}
callService(path, "GET", "list templates", nil) callService(path, "GET", "list templates", nil)
case "describe": case "describe":
if len(args) != 2 { if len(args) != 2 {
......
...@@ -495,12 +495,18 @@ func listRegistryTypesHandlerFunc(w http.ResponseWriter, r *http.Request) { ...@@ -495,12 +495,18 @@ func listRegistryTypesHandlerFunc(w http.ResponseWriter, r *http.Request) {
return return
} }
values, err := url.ParseQuery(r.URL.RawQuery)
if err != nil {
util.LogAndReturnError(handler, http.StatusBadRequest, err, w)
return
}
var regex *regexp.Regexp var regex *regexp.Regexp
regexString, err := getPathVariable(w, r, "regex", handler) regexString := values.Get("regex")
if err == nil { if regexString != "" {
regex, err = regexp.Compile(regexString) regex, err = regexp.Compile(regexString)
if err != nil { if err != nil {
util.LogAndReturnError(handler, http.StatusInternalServerError, err, w) util.LogAndReturnError(handler, http.StatusBadRequest, err, w)
return return
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment