[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:
parent
8271cde1e2
commit
ecb040c177
@ -47,7 +47,7 @@ Queue image
|
|||||||
Queues image for caching.
|
Queues image for caching.
|
||||||
*(Since Image API v2.14)*
|
*(Since Image API v2.14)*
|
||||||
|
|
||||||
Normal response codes: 200
|
Normal response codes: 202
|
||||||
|
|
||||||
Error response codes: 400, 401, 403, 404
|
Error response codes: 400, 401, 403, 404
|
||||||
|
|
||||||
|
@ -238,7 +238,9 @@ class CachedImageDeserializer(wsgi.JSONRequestDeserializer):
|
|||||||
|
|
||||||
|
|
||||||
class CachedImageSerializer(wsgi.JSONResponseSerializer):
|
class CachedImageSerializer(wsgi.JSONResponseSerializer):
|
||||||
pass
|
|
||||||
|
def queue_image_from_api(self, response, result):
|
||||||
|
response.status_int = 202
|
||||||
|
|
||||||
|
|
||||||
def create_resource():
|
def create_resource():
|
||||||
|
@ -79,7 +79,7 @@ class TestImageCache(functional.SynchronousAPIBase):
|
|||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return response.json
|
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
|
# Queue image for prefetching
|
||||||
path = '/v2/cache/%s' % image_id
|
path = '/v2/cache/%s' % image_id
|
||||||
response = self.api_put(path)
|
response = self.api_put(path)
|
||||||
|
Loading…
Reference in New Issue
Block a user