summaryrefslogtreecommitdiff
path: root/admin.go
diff options
context:
space:
mode:
Diffstat (limited to 'admin.go')
-rw-r--r--admin.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/admin.go b/admin.go
index 570d94c..d6f1787 100644
--- a/admin.go
+++ b/admin.go
@@ -711,6 +711,12 @@ traverseLoop:
return fmt.Errorf("unrecognized method %s", method)
}
} else {
+ // if we are "PUTting" a new resource, the key(s) in its path
+ // might not exist yet; that's OK but we need to make them as
+ // we go, while we still have a pointer from the level above
+ if v[part] == nil && method == http.MethodPut {
+ v[part] = make(map[string]interface{})
+ }
ptr = v[part]
}