Update routing.py

Fix index out of range unandled exception when request.postpath is an empty list
parent aca1a7b8
...@@ -212,7 +212,7 @@ class RequestRouter: ...@@ -212,7 +212,7 @@ class RequestRouter:
self.__filterRequests(request) self.__filterRequests(request)
# standardize URL and remove trailing "/" if necessary # standardize URL and remove trailing "/" if necessary
standardized_postpath = request.postpath if (request.postpath[-1] != '' or request.postpath == ['']) else request.postpath[:-1] standardized_postpath = request.postpath if (len(request.postpath)==0 or request.postpath[-1] != '' or request.postpath == ['']) else request.postpath[:-1]
path = '/'.join(standardized_postpath) path = '/'.join(standardized_postpath)
contentType = MediaType.WILDCARD if HttpHeader.CONTENT_TYPE not in request.received_headers else request.received_headers[HttpHeader.CONTENT_TYPE] contentType = MediaType.WILDCARD if HttpHeader.CONTENT_TYPE not in request.received_headers else request.received_headers[HttpHeader.CONTENT_TYPE]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment