QueryStringParameters encoding issue
Closed this issue · 2 comments
Hi,
I suspect an issue while providing queryParameters.
When performing a query to my API using <API_ROOT>/logs?start_time=2020-10-12T14:00:00%2B02:00&end_time=2020-10-12T15:00:00%2B02:00
I get my query string values in Flask endpoint as:
start_time = "2020-10-12T14:00:00 02:00"
end_time = "2020-10-12T15:00:00 02:00"
and it should be :
start_time = "2020-10-12T14:00:00+02:00"
end_time = "2020-10-12T15:00:00+02:00"
Note: The "+" has been removed
I think this is because API Gateway is providing queryStringParameters decoded and your are not encoding them back to store them in environ["QUERY_STRING"].
If we look to what other WSGI adapters (like Zappa) are doing:
if 'multiValueQueryStringParameters' in event_info:
query = event_info['multiValueQueryStringParameters']
query_string = urlencode(query, doseq=True) if query else ''
else:
query = event_info.get('queryStringParameters', {})
query_string = urlencode(query) if query else ''
Hope it helps.
Fix released in 2.9.1. Thanks again for a clear bug report and sample code. If you try out apig-wsgi, let me know how it works for you.