mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
404s ending in slash redirect to remove that slash, closes #309
This commit is contained in:
parent
3b53eea382
commit
97ae66ccab
2 changed files with 19 additions and 1 deletions
|
|
@ -697,3 +697,13 @@ def inner_html(soup):
|
|||
# This includes the parent tag - so remove that
|
||||
inner_html = html.split('>', 1)[1].rsplit('<', 1)[0]
|
||||
return inner_html.strip()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('path,expected_redirect', [
|
||||
('/fixtures/', '/fixtures'),
|
||||
('/fixtures/simple_view/', '/fixtures/simple_view'),
|
||||
])
|
||||
def test_404_trailing_slash_redirect(app_client, path, expected_redirect):
|
||||
response = app_client.get(path, allow_redirects=False)
|
||||
assert 302 == response.status
|
||||
assert expected_redirect == response.headers["Location"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue