[APIImpact] Correct API response code for PUT /v2/cache/{image_id}

PUT /v2/cache/{image_id} returns HTTP 200 response code to user but as per
proposal it should be HTTP 202. This change returns HTTP 202 response to
user.

Closes-Bug: #1971521
Change-Id: I6a875a38bef5beafe352ab3320f3fd199db89aa1
This commit is contained in:
Abhishek Kekane 2022-05-04 05:41:56 +00:00
parent 8271cde1e2
commit ecb040c177
3 changed files with 5 additions and 3 deletions

View File

@ -47,7 +47,7 @@ Queue image
Queues image for caching.
*(Since Image API v2.14)*
Normal response codes: 200
Normal response codes: 202
Error response codes: 400, 401, 403, 404

View File

@ -238,7 +238,9 @@ class CachedImageDeserializer(wsgi.JSONRequestDeserializer):
class CachedImageSerializer(wsgi.JSONResponseSerializer):
pass
def queue_image_from_api(self, response, result):
response.status_int = 202
def create_resource():

View File

@ -79,7 +79,7 @@ class TestImageCache(functional.SynchronousAPIBase):
if response.status_code == 200:
return response.json
def cache_queue(self, image_id, expected_code=200):
def cache_queue(self, image_id, expected_code=202):
# Queue image for prefetching
path = '/v2/cache/%s' % image_id
response = self.api_put(path)