/api/v1beta1/operations was returning Not Found

Splitting an empty string returns []string{""}, not []string{}
This commit is contained in:
Clayton Coleman
2014-08-03 19:35:17 -04:00
parent 2282f9ce3a
commit 75aa364b3c
2 changed files with 42 additions and 0 deletions

View File

@@ -42,6 +42,9 @@ func (s *APIServer) handleOperation(w http.ResponseWriter, req *http.Request) {
}
trimmed := strings.TrimLeft(req.URL.Path[len(opPrefix):], "/")
parts := strings.Split(trimmed, "/")
if trimmed == "" {
parts = []string{}
}
if len(parts) > 1 {
notFound(w, req)
return