-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
broken interface normalize_path_middleware #3669
Comments
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #3086 (add_static breaks normalize_path_middleware), #1178 (Websocket interface change break existing code), #1292 (broken interface for response.url), #1583 (normalize_path_middleware tests failures), and #445 (Is break in finally intentional?). |
if we change last condition |
@vir-mir, this test case passed. How is it different from your's case? |
@kxepal Why did the final URL in the test change? you send |
@vir-mir Because of redirect? Eventually, it causes new request to new location. |
async def test_bug_3669(aiohttp_client):
async def paymethod(request):
return web.Response(text="OK")
app = web.Application()
app.router.add_route('GET', '/paymethod', paymethod)
app.middlewares.append(
web.normalize_path_middleware(append_slash=False, remove_slash=True)
)
client = await aiohttp_client(app, server_kwargs={'skip_url_asserts': True})
resp = await client.get('/paymethods')
assert resp.url.path == '/paymethod' |
So no redirect involved. That's make a sense. Thanks! |
Hm..autoclose failed. Fixed in master via 8260eda |
Long story short
middleware
normalize_path_middleware
is not working properlyExpected 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
-> 404I think the problem is in the last
if merge_slashes and remove_slash
aiohttp == 3.5.4
Your environment
server
The text was updated successfully, but these errors were encountered: