Skip to content
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

Rename /:memory: to /_memory #1205

Closed
simonw opened this issue Jan 25, 2021 · 3 comments
Closed

Rename /:memory: to /_memory #1205

simonw opened this issue Jan 25, 2021 · 3 comments
Labels
Milestone

Comments

@simonw
Copy link
Owner

simonw commented Jan 25, 2021

For consistency with /_internal - and because then we don't need to escape the : characters.

This change would need to be in before Datasette 1.0. I could land it earlier and set up redirects from the old URLs though.

@simonw simonw added the idea label Jan 25, 2021
@simonw simonw added this to the Datasette 1.0 milestone Jan 25, 2021
@simonw
Copy link
Owner Author

simonw commented Jan 28, 2021

I'm going to do this, with redirects from /:memory:*.

@simonw simonw changed the title Consider renaming /:memory: to /_memory Rename /:memory: to /_memory Jan 28, 2021
@simonw simonw closed this as completed in 1600d2a Jan 28, 2021
@simonw
Copy link
Owner Author

simonw commented Jan 28, 2021

Here are the redirect tests:

datasette/tests/test_api.py

Lines 635 to 648 in 1600d2a

@pytest.mark.parametrize(
"path,expected_redirect",
(
("/:memory:", "/_memory"),
("/:memory:.json", "/_memory.json"),
("/:memory:?sql=select+1", "/_memory?sql=select+1"),
("/:memory:.json?sql=select+1", "/_memory.json?sql=select+1"),
("/:memory:.csv?sql=select+1", "/_memory.csv?sql=select+1"),
),
)
def test_old_memory_urls_redirect(app_client_no_files, path, expected_redirect):
response = app_client_no_files.get(path, allow_redirects=False)
assert response.status == 301
assert response.headers["location"] == expected_redirect

@simonw
Copy link
Owner Author

simonw commented Jan 28, 2021

I also checked that the following works:

echo '{"foo": "bar"}' | sqlite-utils insert _memory.db demo -
datasette _memory.db --memory

Sure enough, it results in the following Datasette homepage - thanks to #509

Datasette___memory___memory_2

simonw added a commit that referenced this issue Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant