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:
self.__filterRequests(request)
# 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)
contentType = MediaType.WILDCARD if HttpHeader.CONTENT_TYPE not in request.received_headers else request.received_headers[HttpHeader.CONTENT_TYPE]
......@@ -428,4 +428,4 @@ class RequestRouter:
def __filterResponses(self,request,response):
"""Filters incoming requests"""
for webFilter in self.__responseFilters:
webFilter.filterResponse(request,response)
\ No newline at end of file
webFilter.filterResponse(request,response)
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