* fix #3131 fix API Gateway:delete_api_key return wrong status code * lint
This commit is contained in:
parent
b5c7356b20
commit
1b355f7f06
@ -466,6 +466,7 @@ class APIGatewayResponse(BaseResponse):
|
||||
url_path_parts = self.path.split("/")
|
||||
apikey = url_path_parts[2]
|
||||
|
||||
status_code = 200
|
||||
if self.method == "GET":
|
||||
apikey_response = self.backend.get_apikey(apikey)
|
||||
elif self.method == "PATCH":
|
||||
@ -473,7 +474,9 @@ class APIGatewayResponse(BaseResponse):
|
||||
apikey_response = self.backend.update_apikey(apikey, patch_operations)
|
||||
elif self.method == "DELETE":
|
||||
apikey_response = self.backend.delete_apikey(apikey)
|
||||
return 200, {}, json.dumps(apikey_response)
|
||||
status_code = 202
|
||||
|
||||
return status_code, {}, json.dumps(apikey_response)
|
||||
|
||||
def usage_plans(self, request, full_url, headers):
|
||||
self.setup_class(request, full_url, headers)
|
||||
|
@ -1906,7 +1906,8 @@ def test_api_keys():
|
||||
response = client.get_api_keys()
|
||||
len(response["items"]).should.equal(2)
|
||||
|
||||
client.delete_api_key(apiKey=apikey_id)
|
||||
response = client.delete_api_key(apiKey=apikey_id)
|
||||
response["ResponseMetadata"]["HTTPStatusCode"].should.equal(202)
|
||||
|
||||
response = client.get_api_keys()
|
||||
len(response["items"]).should.equal(1)
|
||||
|
Loading…
Reference in New Issue
Block a user