summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef_zero/endpoints/cookbook_version_endpoint.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef_zero/endpoints/cookbook_version_endpoint.rb b/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
index 1ff74e8..7712fac 100644
--- a/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
+++ b/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
@@ -8,7 +8,7 @@ module ChefZero
# /cookbooks/NAME/VERSION
class CookbookVersionEndpoint < RestObjectEndpoint
def get(request)
- if request.rest_path[2] == "_latest"
+ if request.rest_path[2] == "_latest" || request.rest_path[2] == "latest"
request.rest_path[2] = latest_version(get_data(request, request.rest_path[0..1]).keys)
end
super(request)
@@ -51,6 +51,10 @@ module ChefZero
end
def delete(request)
+ if request.rest_path[2] == "_latest" || request.rest_path[2] == "latest"
+ request.rest_path[2] = latest_version(get_data(request, request.rest_path[0..1]).keys)
+ end
+
deleted_cookbook = get_data(request, request.rest_path)
response = super(request)
cookbook_name = request.rest_path[1]