Closed
Description
Long story short
middleware normalize_path_middleware is not working properly
Expected behaviour
I appeal to /paymethods, there is an endpoint /paymethod
/paymethod -> 200
/paymethods -> 301 -> /paymethod
settings: normalize_path_middleware(remove_slash=True, append_slash=False)
if switch off
/paymethod -> 200
/paymethods -> 404
I think the problem is in the last if merge_slashes and remove_slash
if merge_slashes:
paths_to_check.append(re.sub('//+', '/', path))
if append_slash and not request.path.endswith('/'):
paths_to_check.append(path + '/')
if remove_slash and request.path.endswith('/'):
paths_to_check.append(path[:-1])
if merge_slashes and append_slash:
paths_to_check.append(
re.sub('//+', '/', path + '/'))
if merge_slashes and remove_slash:
merged_slashes = re.sub('//+', '/', path)
paths_to_check.append(merged_slashes[:-1])aiohttp == 3.5.4
Your environment
server