8000 fix validator check during invocation, still need test · localstack/localstack@f1bec9e · GitHub
[go: up one dir, main page]

Skip to content

Commit f1bec9e

Browse files
committed
fix validator 10000 check during invocation, still need test
1 parent b5be94a commit f1bec9e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

localstack/services/apigateway/invocations.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
from typing import Dict
44

5+
from botocore.exceptions import ClientError
56
from jsonschema import ValidationError, validate
67
from requests.models import Response
78

@@ -57,11 +58,15 @@ def is_request_valid(self) -> bool:
5758
return True
5859

5960
# check if there is a validator for this request
60-
validator = self.apigateway_client.get_request_validator(
61-
restApiId=self.context.api_id, requestValidatorId=resource["requestValidatorId"]
62-
)
63-
if validator is None:
64-
return True
61+
try:
62+
validator = self.apigateway_client.get_request_validator(
63+
restApiId=self.context.api_id, requestValidatorId=resource["requestValidatorId"]
64+
)
65+
except ClientError as e:
66+
if "NotFoundException" in e:
67+
return True
68+
69+
raise
6570

6671
# are we validating the body?
6772
if self.should_validate_body(validator):

0 commit comments

Comments
 (0)
0