Merge pull request #2733 from griffint61/feature/lambda_get_function_ResourceNotFoundException
Added 'x-amzn-ErrorType' in the return header for missing lambda function
This commit is contained in:
commit
1b4d0b7a1d
@ -295,7 +295,7 @@ class LambdaResponse(BaseResponse):
|
|||||||
code["Configuration"]["FunctionArn"] += ":$LATEST"
|
code["Configuration"]["FunctionArn"] += ":$LATEST"
|
||||||
return 200, {}, json.dumps(code)
|
return 200, {}, json.dumps(code)
|
||||||
else:
|
else:
|
||||||
return 404, {}, "{}"
|
return 404, {"x-amzn-ErrorType": "ResourceNotFoundException"}, "{}"
|
||||||
|
|
||||||
def _get_aws_region(self, full_url):
|
def _get_aws_region(self, full_url):
|
||||||
region = self.region_regex.search(full_url)
|
region = self.region_regex.search(full_url)
|
||||||
|
@ -78,7 +78,7 @@ def lambda_handler(event, context):
|
|||||||
|
|
||||||
def get_test_zip_file4():
|
def get_test_zip_file4():
|
||||||
pfunc = """
|
pfunc = """
|
||||||
def lambda_handler(event, context):
|
def lambda_handler(event, context):
|
||||||
raise Exception('I failed!')
|
raise Exception('I failed!')
|
||||||
"""
|
"""
|
||||||
return _process_lambda(pfunc)
|
return _process_lambda(pfunc)
|
||||||
@ -455,7 +455,7 @@ def test_get_function():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Test get function when can't find function name
|
# Test get function when can't find function name
|
||||||
with assert_raises(ClientError):
|
with assert_raises(conn.exceptions.ResourceNotFoundException):
|
||||||
conn.get_function(FunctionName="junk", Qualifier="$LATEST")
|
conn.get_function(FunctionName="junk", Qualifier="$LATEST")
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ def test_lambda_can_be_deleted_by_cloudformation():
|
|||||||
# Verify function was deleted
|
# Verify function was deleted
|
||||||
with assert_raises(ClientError) as e:
|
with assert_raises(ClientError) as e:
|
||||||
lmbda.get_function(FunctionName=created_fn_name)
|
lmbda.get_function(FunctionName=created_fn_name)
|
||||||
e.exception.response["Error"]["Code"].should.equal("404")
|
e.exception.response["Error"]["Code"].should.equal("ResourceNotFoundException")
|
||||||
|
|
||||||
|
|
||||||
def create_stack(cf, s3):
|
def create_stack(cf, s3):
|
||||||
|
Loading…
Reference in New Issue
Block a user