SQS add missing validation to ReceiveMessage (#1595)
* SQS receive_message - enforce bounds on MaxNumberOfMessages as AWS does * SQS receive_message - enforce bounds on WaitTimeSeconds as AWS does
This commit is contained in:
parent
21a264c337
commit
fad4394474
2 changed files with 44 additions and 12 deletions
|
|
@ -325,11 +325,27 @@ class SQSResponse(BaseResponse):
|
|||
except TypeError:
|
||||
message_count = DEFAULT_RECEIVED_MESSAGES
|
||||
|
||||
if message_count < 1 or message_count > 10:
|
||||
return self._error(
|
||||
"InvalidParameterValue",
|
||||
"An error occurred (InvalidParameterValue) when calling "
|
||||
"the ReceiveMessage operation: Value %s for parameter "
|
||||
"MaxNumberOfMessages is invalid. Reason: must be between "
|
||||
"1 and 10, if provided." % message_count)
|
||||
|
||||
try:
|
||||
wait_time = int(self.querystring.get("WaitTimeSeconds")[0])
|
||||
except TypeError:
|
||||
wait_time = queue.receive_message_wait_time_seconds
|
||||
|
||||
if wait_time < 0 or wait_time > 20:
|
||||
return self._error(
|
||||
"InvalidParameterValue",
|
||||
"An error occurred (InvalidParameterValue) when calling "
|
||||
"the ReceiveMessage operation: Value %s for parameter "
|
||||
"WaitTimeSeconds is invalid. Reason: must be <= 0 and "
|
||||
">= 20 if provided." % wait_time)
|
||||
|
||||
try:
|
||||
visibility_timeout = self._get_validated_visibility_timeout()
|
||||
except TypeError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue